Commit Graph

11593 Commits

Author SHA1 Message Date
Gregory Sanders 6b79eed2e8 there are four tests 2022-04-07 06:54:02 +09:30
Rusty Russell 836c1b805b doc: update c-lightning to Core Lightning almost everywhere.
Mostly comments and docs: some places are actually paths, which
I have avoided changing.  We may migrate them slowly, particularly
when they're user-visible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-07 06:53:26 +09:30
Rusty Russell 8c2f3ab5fe CHANGELOG.md: fix typos
Reported-by: @endothermicdev
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-07 06:53:26 +09:30
Rusty Russell d95ea51a73 lightning-cli: document the real argument handling (for special effects).
And fix it to pass through decimals like the man page promises!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-07 06:53:26 +09:30
Rusty Russell 356514c753 doc: note how to do Rust builds on Ubuntu, at least.
In particular, using cargo to install rustfmt doesn't work.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-07 06:53:26 +09:30
Clay Shoaf 17903c89f2
Update INSTALL.md
changed `make` to `poetry run make`.
Also moved the spot where `poetry install` is run as it wouldn't make sense to run it before the project is cloned.
2022-04-06 11:06:08 +09:30
kiwiidb 8ed6b7050b build: bump zlib dependency 2022-04-06 08:06:50 +09:30
Rusty Russell d18817a525 wallet: don't get so upset on orphaned HTLC.
User grubman on IRC reported a crash due to new HTLC checks:

```
2022-04-05T01:15:17.707Z **BROKEN** wallet: Missing preimage for orphaned HTLC; replacing with zeros
...
2022-04-05T01:15:44.950Z **BROKEN** lightningd: check_already_failed:Both failed and succeeded?
2022-04-05T01:15:45.020Z **BROKEN** lightningd: FATAL SIGNAL 6 (version v0.11.0rc1-modded)
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: common/daemon.c:38 (send_backtrace) 0xaaaab8f7f8bb
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: common/daemon.c:46 (crashdump) 0xaaaab8f7f91b
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa4a315bf
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa45c6cd8
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa45b3a27
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/log.c:821 (fatal_vfmt) 0xaaaab8f3e1b7
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/log.c:829 (fatal) 0xaaaab8f3e24b
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/htlc_end.c:87 (corrupt) 0xaaaab8f325d3
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/htlc_end.c:175 (htlc_out_check) 0xaaaab8f32ee3
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:1471 (check_already_failed) 0xaaaab8f53ea7
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:1575 (onchain_failed_our_htlc) 0xaaaab8f54aab
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/onchain_control.c:411 (handle_missing_htlc_output) 0xaaaab8f4037b
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/onchain_control.c:544 (onchain_msg) 0xaaaab8f409bf
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/subd.c:556 (sd_msg_read) 0xaaaab8f5f8ef
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0xaaaab8fda197
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0xaaaab8fda76f
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0xaaaab8fda82f
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:453 (io_loop) 0xaaaab8fdc77f
2022-04-05T01:15:45.020Z **BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:22 (io_loop_with_timers) 0xaaaab8f37857
2022-04-05T01:15:45.021Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:1181 (main) 0xaaaab8f3bcff
2022-04-05T01:15:45.021Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa45b3d4f
2022-04-05T01:15:45.021Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xaaaab8f1ed33
```

Since no HTLCs are likely to still be pending since v0.6.1, we can remove that compat
code.  Indeed, this happens on my node: we've not loaded the incoming HTLC because
it's resolved.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-05 15:39:38 +09:30
Rusty Russell c55ae7cbcb CHANGELOG.md: update for final PR merge.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-05 08:48:46 +09:30
William Casarin cf2e2d7445 changelog: remove duplicate pr links 2022-04-05 08:48:46 +09:30
William Casarin 79c2929085 changelog: sort pr links 2022-04-05 08:48:46 +09:30
Rusty Russell 600525d74c v0.11.0rc1
Finally!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-05 08:48:46 +09:30
Michael Schmoock 0799328775 pytest: test custom config options for fees and htlc limits 2022-04-05 05:45:04 +09:30
Michael Schmoock 62df569d49 pytest: option disable-ip-discovery 2022-04-05 05:45:04 +09:30
Michael Schmoock e99f9ad6d6 doc: htlc_minimum_msat htlc_maximum_msat announce_discovered_ip
doc/schemas: adds htlc min/max and ip discovery
2022-04-05 05:45:04 +09:30
Michael Schmoock 21fd3b22d4 config: adds htlc_minimum_msat htlc_maximum_msat announce_discovered_ip
This adds config and commandline options for htlc_min_msat, htlc_max_msat and
announce_discovered_ip. The default is 0msat for htlc_min_msat, unlimited for
htlc_max_msat and enabled for announce_discovered_ip.

The announce_discovered_ip gets the disable commandline switch --disable-ip-discovery

Changelog-added: Config options for htlc_min_msat, htlc_max_msat and announce_discovered_ip.
2022-04-05 05:45:04 +09:30
Rusty Russell c1e7c14c46 pytest: test that deduplication for `bolt11` works as expected.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-04 20:26:04 +09:30
Rusty Russell f51a3d8ef7 plugins/pay: always include `bolt11` (and `description`) in listpays.
We were setting it on the root, but that doesn't get handed to
sendpay.  Our schema doesn't *require* bolt11, either, so this was
missed (there could be a *bolt12* instead).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `listpays` always includes `bolt11` or `bolt12` field.
2022-04-04 20:26:04 +09:30
Rusty Russell e47786da04 pay/sendpay: also store description in case bolt11 uses description_hash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-04 20:26:04 +09:30
Rusty Russell d5c736fe86 pay: require description if bolt11 only has hash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `pay` has `description` parameter, will be required if bolt11 only has a hash.
Changelog-Deprecated: JSON-RPC: `pay` for a bolt11 which uses a `description_hash`, without setting `description`.
2022-04-04 20:26:04 +09:30
Rusty Russell 6c54e0e7e7 pay: add absolute "maxfee" parameter.
This is what LND does, and it's better for upper layers than trying to
twist our maxfeepercent / exemptfee heuristics to suit.

(I don't remember who complained about this, sorry!)

I'm doing this now because I want to add YA parameter next!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `pay` has new parameter `maxfee` for setting absolute fee (instead of using `maxfeepercent` and/or `exemptfee`)
2022-04-04 20:26:04 +09:30
Rusty Russell 713cd0540d doc: document `pay` localofferid field.
Fixes: #4665
Reported-by: @shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-04 20:26:04 +09:30
Rusty Russell 92028ebaee plugins/pay: remove legacypay.
I think the new pay command has proven itself in the last 18 months!

Also various pay tests took "compat" then didn't use it, so clean them
up.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: `legacypay` (`pay` replaced it in 0.9.0).
2022-04-04 20:26:04 +09:30
Rusty Russell 591a51ca6a pytest: fix invalid invoice() call.
Trips on our RPC checking introduced at the same time: msat should be
an integer or an "xxxmsat"/sat/btc string.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-04 20:26:04 +09:30
Christian Decker aae5e3d070 cln-grpc: Final generation of derived files
Didn't want to pollute each commit with the changes in the derived
files so here are all the changes in one commit :-)
2022-04-02 09:46:01 +10:30
Christian Decker be04f25666 msggen: Don't assume we have properties in the schema 2022-04-02 09:46:01 +10:30
Rusty Russell 5a1e58f0dc pytest: fix RUST=0 pytest.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Christian Decker 241a891190 cln-rpc: Yet more RPC methods being mapped
- disconnect
 - feerates
 - getroute
 - listforwards
 - listpays
 - ping
 - signmessage
2022-04-02 09:46:01 +10:30
Christian Decker 0c08ca8f27 cln-grpc: Add conversion test for listpeers 2022-04-02 09:46:01 +10:30
Christian Decker 33960be040 cln-rpc: Test that we forward errors correctly
So far we were papering over the actual error with a generic string
that isn't very useful. Now we decode the error and forward it through
the grpc layer as well (though still as a string).
2022-04-02 09:46:01 +10:30
Christian Decker 4aec3d3b9c doc: Annotate secrets and hashes in the JSON Schemas 2022-04-02 09:46:01 +10:30
Christian Decker d0f6e8c8a6 cln-rpc: Add Sha256 and Secret types 2022-04-02 09:46:01 +10:30
Christian Decker cd9c00b629 cln-rpc: Log requests and responses 2022-04-02 09:46:01 +10:30
Christian Decker 940f5c350c cln-rpc: Skip the HTLC state for now
It's schema definition is weirdly asymmetric, with variants dependent
on another fields' value. Need to decide if we want to either
hand-code a superset or make a more complex decoding, but definitely
not something we'd want the generator to be able to do.
2022-04-02 09:46:01 +10:30
Christian Decker d5f7548c8f cln-rpc: The JSON `number` type is a float not an int
Got some issues parsing dates for example.
2022-04-02 09:46:01 +10:30
Christian Decker ecda4f717f cln-rpc: Move tests into separate file
These json structs are gigantic, so let's externalize them a bit.
2022-04-02 09:46:01 +10:30
Christian Decker 1613c44b0a cln-rpc: Make Pubkey and ShortChannelId proper types 2022-04-02 09:46:01 +10:30
Christian Decker ef145c7900 msggen: Add RoutehintList as a primitive 2022-04-02 09:46:01 +10:30
Christian Decker ec5cd92580 msggen: Add model-side overrides
Sometimes we just want to paper over the schema directly. Mostly
useful to sidestep the `oneof` things that are required for
expressiveness.
2022-04-02 09:46:01 +10:30
Christian Decker 1f40db3594 msggen: Add parser for "oneOf" 2022-04-02 09:46:01 +10:30
Rusty Russell c1ee32027d pyln-testing: check the request schemas.
This means suppressing schemas in some places too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell b45b731c55 doc/schemas: fixes for request schemas.
Types are fixed, in particular:

* rename "OutputDesc" to more consistent "outputdesc".
* rename "utxo" to more consistent "outpoint".
* it's "boolean" not "bool".
* "number" means int or float, usually it should be u32.

Specific commands:

* close `id` can be by channel id, scid.
* close `feerange` is a feerate type.
* datastore/deldatastore/listdatastore `key` can be singleton.
* delexpiredinvoice: `maxexpirytime` is not required, is a u64.
* invoice/delinvoice/listinvoice `label` can be an integer
* fundpsbt: many fields are u32 not number (JSON for int or float).
* invoice: `msatoshi` can be "any".
* invoice: `expiry` has a type (now must be numeric).
* invoice: `exposeprivatechannels` can be bool or array of scids.
* invoice: `deschashonly` added
* keysend: there's no "float" type, use "number" or "u32" etc.
* keysend: `routehints` is a valid arg, as is `extratlvs` (EXPERIMENTAL_FEATURES)
* listdatastore: `key` is not required.
* newaddr: `addresstype` can be "all"
* pay: `exemptfee` is "msat", new fields `locaofferid` and `exclude`
* sendonion: was mis-formatted, missed `localofferid` and `groupid` fields.
* sendpay: add `localofferid` and `groupid` params.
* signpsbt: add `signonly` param.
* txprepare "outptus" typo.
* waitsendpay: add `groupid` and  fix `partid` type.
* withdraw: `destination` is a bitcoin address, not a pubkey.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell 3b11292e72 pyln-testing: add new schema types.
These are useful for requests:
1. "outpoint": <txid>:<outnum>
2. "feerate": strings or a number
3. "outputdesc": bitcoin-style addresses-as-keys
4. "msat_or_all": amount or "all"
4. "msat_or_any": amount or "any"
5. "short_channel_id_dir": scid with /0 or /1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell 1b6f4e7026 pytest: don't hand a string for an integer value.
lightningd is happy, but our schema won't be.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell 5d8fc84675 pyln-testing: add dev-invoice.
This will override the schema later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell 26bee7a2ab pyln-testing: add dev-pay.
This will override the schema later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell dc924b8859 doc: set additionalProperties to false in all request schemas.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell 9784fa816f lightningd: deprecate invoice expiry suffixes.
Makes types harder, and I've never personally used them.

Changelog-Deprecated: JSON-RPC: `invoice` `expiry` no longer allowed to be a string with suffix, use an integer number of seconds.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30
Rusty Russell bf4d9e30d2 fundpsbt: deprecate reserve=true/false usage.
Make it always a number; this makes the JSON request specification
simpler.  We allowed a number since v0.10.1.

(reserve=True is the default anyway, so usually it can be omitted:
reserve=False becomes reserve=0).

Changelog-Deprecated: JSON-RPC: `fundpsbt`/`utxopsbt` `reserve` must be a number, not bool (for `true` use 72/don't specify, for `false` use 0).  Numbers have been allowed since v0.10.1.
2022-04-02 09:46:01 +10:30
Rusty Russell 3feb634d31 pytest: fix if no rust installed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:46:01 +10:30