Commit Graph

306 Commits

Author SHA1 Message Date
Tony Aldon 672477c95c poetry: add `requests` dependency for clnrest tests in contrib/pyln-testing
`poetry update` did not change the poetry.lock file for contrib/pyln-testing
because it already has `requests`.
2023-11-16 09:07:07 +01:00
Christian Decker 94f4d75006 msggen: Add `Wait` method to managed API
Fixes #6792

Changelog-Added: Cln-RPC: Add `wait` system to cln-rpc and cln-grpc.
2023-11-16 09:02:33 +01:00
Christian Decker bdfd2d5fda msggen: Add `FetchInvoice` method to Rust and grpc bindings
Closes #6844

Changelog-Added: Cln-RPC: Add `fetchinvoice` method to cln-rpc and cln-grpc.
2023-11-16 09:02:33 +01:00
Peter Neuroth 02ca226f88 CHANGELOG.md: Update for 23.11rc1
Update changelog, pyln versions, clnrest version and poetry.lock.

Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
2023-11-03 14:49:12 +01:00
Rusty Russell 2482fd4427 pytest: detect RBF more reliably
```
2023-10-30T20:52:48.0652403Z [gw2] [ 63%] FAILED tests/test_closing.py::test_onchain_timeout[True]
...
...
bitcoind.generate_block(4)
        bitcoind.generate_block(1, wait_for_mempool=txid1)
>       l1.mine_txid_or_rbf(txid2)

tests/test_closing.py:1987: 
```

Turns out that the DEBUG-level "no feechange" RBF can happen, as we can actually
call the RBF routine before we even broadcast the first one:


```
2023-10-30T21:07:42.2201798Z lightningd-1 2023-10-30T20:49:44.184Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 14aa9c78fbcbff01faf96d3e734eba52355437078a67f46b8fbca9e72d1494e5 (fee 121sat) with txid 14aa9c78fbcbff01faf96d3e734eba52355437078a67f46b8fbca9e72d1494e5 (fee 121sat)
2023-10-30T21:07:42.2214788Z lightningd-1 2023-10-30T20:49:44.185Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000->02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000
2023-10-30T21:07:42.2230434Z lightningd-1 2023-10-30T20:49:44.196Z DEBUG   lightningd: sendrawtransaction: 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000
...
2023-10-30T21:07:42.2258455Z lightningd-1 2023-10-30T20:49:44.250Z DEBUG   plugin-bcli: sendrawtx exit 0 (bitcoin-cli -regtest -datadir=/tmp/ltests-b6i5i0cl/test_onchain_timeout_1/lightning-1/ -rpcport=43613 -rpcuser=... -stdinrpcpass sendrawtransaction 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000 0) 
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-11-01 14:11:28 +10:30
Rusty Russell 1d8af90b56 listforwards: add created_index and updated_index fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listforwards` fields `created_index` (old: `id`) and `updated_index`.
2023-10-28 15:48:26 +10:30
Rusty Russell 00ac1a9475 listsendpays: add created_index and updated_index fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `sendpay`, `listsendpays`, `delpay` new fields `created_index` (old: `id`) and `updated_index`.
2023-10-28 15:48:26 +10:30
Aditya Sharma b0c603581f doc/lightning-decode.7: Update the doc 2023-10-27 16:05:28 +10:30
Chris Guida 88ac2dcb7e add test, update schemas, fix warning_custom_fallbacks 2023-10-26 19:11:17 +10:30
Rusty Russell 95f20a3978 lightningd, pyln-testing: do extra checks to make sure check *cannot* write to db.
Put an assertion inside db.c, and run every command we do (in testing) through
a `check` variant.

I inserted a deliberate bug (made addpsbtoutput call wallet_get_newindex()
before returning when running `check`, and indeed, backtrace as expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-26 12:59:55 +10:30
Peter Neuroth 833b7b4baa grpc: Add datastoreusage command
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
2023-10-26 12:58:04 +10:30
Rusty Russell 075f79033a pyln-testing: fix LihgtningNode.openchannel()
`[False]` is considered True in Python, so this flake fix didn't work.

```
>>> if [False]:
...     print('x')
... 
x
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-25 07:00:05 +10:30
Christian Decker dfea5fbe6d grpc: Add WaitBlockHeight method to grpc interface 2023-10-24 10:24:52 +10:30
Rusty Russell 6a67615274 pyln-testing: make disconnects continue after restart.
We truncate the file on stop(), but don't re-created it on start().

We didn't notice it before, but the net

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-23 15:48:50 +10:30
Michael Schmoock 8ac9c73ea8 pytests: make pay helper able to route (optionaly)
This makes the pay helper function being able to route
a payment using the optional `route` paramter that defaults to `False`.

I added this, as some plugins maintained their own version of `pay` that
needed routed payment helper.

Changelog-None
2023-10-17 14:53:53 +10:30
Rusty Russell 176a58f9e0 pytest: wean many tests off the assumption that listchannels shows private channels.
We will be changing this, or at least deprecating it, so get our
tests ready.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-04 08:02:33 +10:30
Rusty Russell 6c15ea44dd pytest: use --developer instead of environment variable.
And we always enable it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 20:08:24 +09:30
Rusty Russell f725edad62 plugins: remove #if DEVELOPER.
And rename dev-only-option `use_shadow` to `dev_use_shadow`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 20:08:24 +09:30
Rusty Russell a9c05d7d16 pytest: test for mutual close fail under very low feerates.
```
$ l1-cli close 445x1x1 
# Sending closing fee offer 183sat, with range 0sat-183sat
# Received closing fee offer 183sat, with range 0sat-1000000sat
{
   "tx": "0200000000010153ce29f4df20875492760ec51092d01ade3da99ffd72c3ff47b02e8f78a5845a0100000000ffffffff02b882010000000000225120847b3d31b036c0b4fad77fd41805f375f4fc9507d52f2a19d858b43975a633b0d1be0d000000000022512017912fd7fc767d03e02461bd932556d78291ea226db5efec84d84a5c753a650a0400473044022005b184a595ec0b650dffb3168d003b13ae0d98d456d879ec7fac7012f3dbad6202202f5a9620a59fb3cb9269be3b2a941f18fe1b7e3037c259125c56d3ec86c8e91a014730440220559f1c2a578e35a975466bb6f2319d313cd79070add77c51b6f6aeb25f7eae9802204749e84e7f8a777c66896a38588f6046a28653a493c34c79a0080580a0f389ec01475221024ff290301210ddffa14db591eb629d864bb4b4583586f5bffaaebc4ca8d5edef2102e0de3f54ca6cf38cb527b326242bf418a4a0a50485c97999074e69e127216fd052ae00000000",
   "txid": "216ed9adf8df623770e219f52b31350de60cd1b236d6f043664d9eb5bc462ad4",
   "type": "mutual"
}
rusty@rusty-Framework:~/devel/cvs/lightning (master)$ bt-cli getrawmempool
[
]
```

Logs show:

```
2023-08-11T02:20:13.947Z DEBUG   plugin-bcli: sendrawtx exit 26 (bitcoin-cli -regtest -datadir=/home/rusty/.bitcoin sendrawtransaction 0200000000010153ce29f4df20875492760ec51092d01ade3da99ffd72c3ff47b02e8f78a5845a0100000000ffffffff02b882010000000000225120847b3d31b036c0b4fad77fd41805f375f4fc9507d52f2a19d858b43975a633b0d1be0d000000000022512017912fd7fc767d03e02461bd932556d78291ea226db5efec84d84a5c753a650a0400473044022005b184a595ec0b650dffb3168d003b13ae0d98d456d879ec7fac7012f3dbad6202202f5a9620a59fb3cb9269be3b2a941f18fe1b7e3037c259125c56d3ec86c8e91a014730440220559f1c2a578e35a975466bb6f2319d313cd79070add77c51b6f6aeb25f7eae9802204749e84e7f8a777c66896a38588f6046a28653a493c34c79a0080580a0f389ec01475221024ff290301210ddffa14db591eb629d864bb4b4583586f5bffaaebc4ca8d5edef2102e0de3f54ca6cf38cb527b326242bf418a4a0a50485c97999074e69e127216fd052ae00000000) error code: -26\nerror message:\nmin relay fee not met, 183 < 192

Indeed, tx weight is 192!
```

Reported-by: @ShahanaFarooqui
2023-08-12 13:17:46 +09:30
Christian Decker 9074341ef6 msggen: Add `staticbackup` call to list of managed methods
Changelog-Added: cln-grpc: Added `staticbackup` support to cln-grpc
2023-08-06 12:34:36 +09:30
Rusty Russell 0c20cc70ab pyln-client, pyln-proto, pyln-testing: update to new versions.
I actually did this manually to send 23.08 to Pypi a few days ago, as it's
required for clnrest.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-08-03 09:05:59 +09:30
Dusty Daemon 4628e3ace8 channeld: Code to implement splicing
Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
2023-07-31 21:00:22 +09:30
Rusty Russell f51ce7be85 pytest: follow RBF txids properly, but ignoring identical "RBF" txs.
`mine_txid_or_rbf` uses is_in_log, which grabs the first line.  Thus it doesn't track when a txid gets "RBF"ed by itself, such as:

```
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat) with txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat)
...
INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
...
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
...
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
```

The simplest fix is to only use INFO lines, which are printed when we actually increase fee.

```
    def test_onchaind_replay(node_factory, bitcoind):
...
        # l1 should still notice that the funding was spent and that we should react to it
        _, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET',
                                                  'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US')
        assert blocks == 200
        bitcoind.generate_block(200)
        # Could be RBF!
>       l1.mine_txid_or_rbf(txid)

tests/test_closing.py:1860: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
contrib/pyln-testing/pyln/testing/utils.py:1292: in mine_txid_or_rbf
    wait_for(lambda: rbf_or_txid_broadcast(txids))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f5d55f770d0>
timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f5d55f770d0>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-28 09:44:58 +09:30
Christian Decker 7b8ea7f60a msggen: Add two missing fields to the `listpays` schema
The fields were missing because they weren't annotated with a type and
a description. Adding those fixes them.

Changelog-Fixed: msggen: `listpays` now includes the missing `amount_msat` and `amount_sent_msat` fields
No-schema-diff-check: fields were always there, just undocumented!
2023-07-27 12:40:28 +09:30
ff 6920e36135 added listhtlcs model 2023-07-24 09:07:24 +09:30
Rusty Russell d25a8ca0fd lightningd: expose created_index and updated_index fields.
If you miss a wait event, you can catch up by doing listinvoices and
getting the max of these fields.  It's also a good debugging clue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-23 13:48:37 +09:30
Rusty Russell b529e79621 lightningd: `setchannel` can set `ignorefeelimits`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `setchannel` adds a new `ignorefeelimits` parameter to allow peer to set arbitrary commitment transaction fees on a per-channel basis.
2023-07-22 13:11:08 +09:30
Rusty Russell 8910529e6a lightningd: expose ignore_fee_limits field in listpeerchannels.
Changelog-Added: JSON-RPC: `listpeerchannels` has a new field `ignore_fee_limits`
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 13:11:08 +09:30
Christian Decker 975046a790 pyln: Make the grpcio dependencies optional
We also document how the grpc test mode works, and why it currently
lacks coverage.

Changelog-Changed: pyln-testing: The grpc dependencies are now optional.
2023-07-21 15:12:03 +09:30
Shahana Farooqui c0bb7f0721 lightningd: updating python v3.7 to v3.8 2023-07-20 11:44:46 +09:30
Greg Sanders 4b70736d13 Support p2tr deposit addresses
Changelog-Added: JSON-RPC: newaddr: p2tr option to create taproot addresses.
Changelog-Changed: Wallet: we now use taproot change addresses.
2023-07-11 11:41:15 +09:30
Christian Decker 6583f0dead pyln: Create a dedicated pyln-grpc-proto package
Having the grpc bindings in the pyln-testing package was always a bit
strange, however it came with additional issues. Due to the way that
protos are handled by protobuf, any name clash, independently of where
we import the protos, would cause an import error. This usually
happens in diamond-pattern dependencies, and so pull out the generated
files into their own package that everyone else can rely on.

Changelog-None
2023-07-10 13:47:38 +09:30
Rusty Russell 0402e645f0 lightningd: add option `opening_anchor_channel` to fundpsbt, utxopsbt.
This is needed when we know we're *opening* an anchor channel, to
override the "do we already have an anchor channel open?" logic.

Also, document the nonwrapped arg added in v23.02.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `fundpsbt` and `utxopsbt` new parameter `opening_anchor_channel` so lightningd knowns it needs emergency reserve for anchors.
2023-06-29 11:28:47 -04:00
Rusty Russell 7894d7136f pytest: adapt all the anchor-iff-EXPERIMENTAL tests to --experimental-anchors.
We use parameterization here.  The old `anchor_expected()` was for
non-zero-fee anchors, and have bitrotted so there are some other
changes as well.

Unfortunately, all the anchor accounting seems to be broken, but I
cannot understand these tests at all.  I had to simply disable them
for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-29 11:28:47 -04:00
Rusty Russell e45bf14300 lightningd: use lowball feerate for commit_tx on anchor channels.
Since we can CPFP, we don't have to track the feerate as closely.  But
it still needs to get in the mempool, so we use 10 sat/byte, or the
100 block estimate if that is higher.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `feerates` has new fields `unilateral_anchor_close` to show the feerate used for anchor channels (currently experimental), and `unilateral_close_nonanchor_satoshis`.
Changelog-Changed: JSON-RPC: `feerates` `unilateral_close_satoshis` now assumes anchor channels if enabled (currently experimental).
2023-06-29 11:28:47 -04:00
Christian Decker 6507d34b50 cln-grpc: Add some missing states to HtlcState 2023-06-23 14:38:23 +09:30
Christian Decker 9f1e1ada2a py: Update dependencies and relax constraints
We were being very restrictive when describing the dependencies, so let's
relax them a bit.
2023-06-18 11:00:32 +09:30
Vincenzo Palazzo 05c13ddfc5 fix(pyln): regenerate the autogenerated files
I noted in some PR that we are failing during the diff of the autogenerated files.

So this will generate the last version of them!

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-06-14 16:36:31 +02:00
Christian Decker 8c02d9587d msggen: Extend support range to v0.10.1 and mark address, added in v23.02 2023-06-13 11:28:35 +09:30
Rusty Russell ea928bfca1 pytest: use modern listconfigs.
Use the configs object, as the others are about to be deprecated.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Rusty Russell 56eb24280c pyln-testing: allow protobuf v4
I need to update gprcio-tools, but it needs protobuf v4.  Christian
added this restriction in a99509db36 to
"Update protobuf dependency to silence dependabot", but perhaps it's
time to actually update?

```
$ poetry update
Updating dependencies
Resolving dependencies... (1.0s)

Because pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing depends on protobuf (>=3.20.3,<4)
 and grpcio-tools (1.54.0) depends on protobuf (>=4.21.6,<5.0dev), pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing is incompatible with grpcio-tools (1.54.0).
So, because cln-meta-project depends on both grpcio-tools (1.54.0) and pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing, version solving failed.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-01 06:40:47 +09:30
Rusty Russell a7786ca742 Revert "Put bitcoind logging in stdout for pytest"
This reverts commit 1037bf3c43.
(It broke elementsd: we no longer see "Done loading")
2023-05-29 18:41:46 +09:30
Christian Decker c029de7d56 msggen: Add preapproveinvoice and preapprovekeysend to msggen 2023-05-29 14:50:13 +09:30
Greg Sanders 1037bf3c43 Put bitcoind logging in stdout for pytest 2023-05-25 11:07:45 +09:30
Rusty Russell b8aa3a579e listtransactions: remove annotations, which were only in EXPERIMENTAL_FEATURES.
I don't know if anyone was using them, they seem half-hearted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Shahana Farooqui d1cf88c62e meta: update changelog and pyln version for 23.05 release
Changelog-None
2023-05-10 09:50:38 -07:00
Shahana Farooqui 4f258a9354 meta: Add changelog for 23.05rc4 2023-05-09 14:04:14 -07:00
Matt Morehouse fe5f3cef51 pyln: remove unused variable
Variable inroduced in 708fb17 is making CI fail.
2023-05-09 13:15:36 -07:00
Shahana Farooqui ea23122880 meta: Add changelog for 23.05rc3 2023-05-05 10:20:27 -07:00
Christian Decker 708fb17fa2 pytest: Add helper to get a grpc stub and test decode 2023-05-05 09:24:07 -07:00