ShahanaFarooqui
4bff697be9
ci: Update Ubuntu version from 20.04 to 22.04
2024-11-19 09:05:55 +10:30
ShahanaFarooqui
4e43b07ee4
ci: Adding missing jq dependency in script
2024-11-19 09:05:55 +10:30
ShahanaFarooqui
e352a72e5e
shellcheck: shellcheck fixes
2024-11-19 09:05:55 +10:30
ShahanaFarooqui
61abfbcad1
ci: Removed CPP check script
2024-11-19 09:05:55 +10:30
Christian Decker
04b4f61308
db: Instrument the DB interactions to trace their execution
2024-11-18 17:46:40 +01:00
Rusty Russell
1b413502e0
lightningd: deprecate experimental-offers option.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: Config: `experimental-offers` (it's now the default).
2024-11-18 10:42:54 +01:00
Rusty Russell
0cc52bc281
pytest: don't set experimental-offers
in tests: it's the default now.
...
And about to be deprecated.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
46b0eb108b
plugins: don't check for experimental-offers option: it's the default now.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
e254d91bd2
docs: no longer tell people experimental-offers is required.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
ca41414da4
offers: make it the default.
...
Changelog-Changed: offers: bolt12 now enabled by default (finally!)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
05fbcb4d9b
xpay: make sure to call preapproveinvoice!
...
This is required for VLS which wants to know (and potentially decline) invoices
we're trying to pay.
As a nice side effect, our "check" command for xpay now does much more thorough
checking of arguments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
2c15dc0e5b
xpay: make self-pay work.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
229fc3f2b4
xpay: make the xpay layer persistent.
...
As the first user of a persistent layer, this tripped tests which
assumed the datastore would be empty!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
c93153ec37
lightningd: allow builtin plugins to be stopped.
...
These are automatically marked "important", in the sense that we won't startup
if they are not working, but this wasn't meant to disallow stopping them.
Changelog-Changed: JSON-RPC: built-in plugins can now be stopped using "plugin stop".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
41e15b1ac9
xpay: age the "xpay" layer so we forget information older than 1 hour.
...
1 hour is what mpay uses, so stick with that for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
c715253af7
xpay: option to steal easy commands from pay
.
...
Note: won't work with grpc (or probably other tools), since the output
is different. But good for testing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Config: option `xpay-handle-pay` can be used to call xpay when pay is used in many cases (but output is different from pay!)
2024-11-18 11:03:26 +10:30
Rusty Russell
090d605527
libplugin: allow aux_command use in init()
...
Because we initalized plugin->io_rpc_conn *after* calling plugin->init,
send_outreq would do a (harmless, in our case) wakeup on an uninitialized address:
```
==1164079== Conditional jump or move depends on uninitialised value(s)
==1164079== at 0x1628FC: backend_wake (poll.c:227)
==1164079== by 0x160B98: io_wake (io.c:384)
==1164079== by 0x1160A8: ld_rpc_send (libplugin.c:255)
==1164079== by 0x1187E0: send_outreq (libplugin.c:1099)
==1164079== by 0x115041: init (xpay.c:1620)
```
Solution is simple: set plugin->io_rpc_conn to NULL, and don't wake it in this case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
64c1522597
xpay: don't use rpc_scan or jsonrpc_request_sync.
...
These will deadlock once we hook into rpc_command, so avoid them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
dd4d3940b1
xpay: implement partial payments.
...
Explicitly tell xpay to only make part of a payment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
47318a7875
xpay: add deadline.
...
We promised this in the schema originally, now support it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
06a9aa8907
pytest: test xpay with channeld_fakenet to pay top 100 nodes.
...
We also put broken status messages for invalid CLTVs and amounts in onions,
to catch them in CI.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
e38ef42041
devtools: bolt11-cli encode command to make fake invoices.
...
This will let us make invoices for the fake network.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
7c2407ef48
xpay: new plugin which uses askrene, injectpaymentonion.
...
Changelog-Added: Plugins: cln-xpay, with associated `xpay` command for payments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
8c051c555e
pyln-testing: don't skip renepay and askrene!
...
We called these `cln-renepay` and `cln-askrene` which meant we didn't
test them under valgrind!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
38d229df3d
tools/generate-wire.py: make sure TLV array fields are allocated off TLV.
...
Otherwise the whole thing cannot be tal_steal() onto a different parent.
Here's the difference in generated files:
--- ./wire/onion_wiregen.c.pre 2024-10-23 12:26:09.023176933 +1030
+++ ./wire/onion_wiregen.c 2024-10-23 12:26:52.434828303 +1030
@@ -128,7 +128,7 @@
blinded_path->path = num_hops ? tal_arr(blinded_path, struct blinded_path_hop *, 0) : NULL;
for (size_t i = 0; i < num_hops; i++) {
struct blinded_path_hop * tmp;
- tmp = fromwire_blinded_path_hop(blinded_path, cursor, plen);
+ tmp = fromwire_blinded_path_hop(blinded_path->path, cursor, plen);
tal_arr_expand(&blinded_path->path, tmp);
}
--- ./wire/bolt12_wiregen.c.pre 2024-10-23 12:26:09.079176474 +1030
+++ ./wire/bolt12_wiregen.c 2024-10-23 12:26:52.612826902 +1030
@@ -316,7 +316,7 @@
r->offer_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->offer_paths, cursor, plen);
tal_arr_expand(&r->offer_paths, tmp);
}
}
@@ -729,7 +729,7 @@
r->offer_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->offer_paths, cursor, plen);
tal_arr_expand(&r->offer_paths, tmp);
}
}
@@ -1052,7 +1052,7 @@
r->invreq_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->invreq_paths, cursor, plen);
tal_arr_expand(&r->invreq_paths, tmp);
}
}
@@ -1385,7 +1385,7 @@
r->offer_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->offer_paths, cursor, plen);
tal_arr_expand(&r->offer_paths, tmp);
}
}
@@ -1708,7 +1708,7 @@
r->invreq_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->invreq_paths, cursor, plen);
tal_arr_expand(&r->invreq_paths, tmp);
}
}
@@ -1781,7 +1781,7 @@
r->invoice_paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL;
while (*plen != 0) {
struct blinded_path * tmp;
- tmp = fromwire_blinded_path(r, cursor, plen);
+ tmp = fromwire_blinded_path(r->invoice_paths, cursor, plen);
tal_arr_expand(&r->invoice_paths, tmp);
}
}
@@ -1808,7 +1808,7 @@
r->invoice_blindedpay = *plen ? tal_arr(r, struct blinded_payinfo *, 0) : NULL;
while (*plen != 0) {
struct blinded_payinfo * tmp;
- tmp = fromwire_blinded_payinfo(r, cursor, plen);
+ tmp = fromwire_blinded_payinfo(r->invoice_blindedpay, cursor, plen);
tal_arr_expand(&r->invoice_blindedpay, tmp);
}
}
@@ -1927,7 +1927,7 @@
r->invoice_fallbacks = *plen ? tal_arr(r, struct fallback_address *, 0) : NULL;
while (*plen != 0) {
struct fallback_address * tmp;
- tmp = fromwire_fallback_address(r, cursor, plen);
+ tmp = fromwire_fallback_address(r->invoice_fallbacks, cursor, plen);
tal_arr_expand(&r->invoice_fallbacks, tmp);
}
}
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
99cc81b90a
pytest: Allow a specific lightningd for DEBUG_SUBD
...
e.g. "lightningd-1:xpay" or even "1:xpay" means it will only apply to l1.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
611e430754
lightningd: injectpaymentonion should fail on re-attempts.
...
This is clearer than transparently succeeding: the user might think they
paid twice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
d6152fdc40
lightningd: don't include empty error in onion returned on failed injectpaymentonion.
...
fail->msg can be NULL for local failures (the error message itself is more informative
in this case). Use the generic "something went wrong" message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
ef475db478
common: sphinx_path_new to take explicit len.
...
Useful if associated_data is not a tal pointer (xpay wants this).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
80357911fb
lightningd: fix clang 19 compile error.
...
```
Ubuntu clang version 19.1.0 (++20240901083933+6d7e428df611-1~exp1~20240901084058.28)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
./configure CC=clang-19
make -j17
<snip>
cc lightningd/offer.c
cc lightningd/signmessage.c
lightningd/subd.c:945:16: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
945 | char permfail[strlen("PERMFAIL")];
| ^~~~~~~~~~~~~~~~~~
cc wallet/db.c
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: build: fix overzealous warning from clang 19.
2024-11-17 22:36:04 +10:30
ShahanaFarooqui
2dd0d4c88a
test: listaddresses tests
...
Added a new test for listaddresses rpc.
2024-11-17 20:27:13 +10:30
ShahanaFarooqui
117dd748ba
doc: Add schema for listaddresses
2024-11-17 20:27:13 +10:30
ShahanaFarooqui
fd27cda4f4
rpc: Added listaddresses command
...
Changelog-Added: New rpc `listaddresses` to list issued addresses from the node.
2024-11-17 20:27:13 +10:30
ShahanaFarooqui
af2f9601c6
wallet: list addresses query
2024-11-17 20:27:13 +10:30
ShahanaFarooqui
bb252983c2
wallet: insert addrtype ADDR_ALL
for issued addresses
2024-11-17 20:27:13 +10:30
Rusty Russell
6da97e6461
wallet: save keytype when issuing new address.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
Rusty Russell
13af9bcfe7
lightningd: use P2TR for onchain tx spends.
...
Both for HTLC txs and the to-self outputs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Wallet: Taproot addresses are used for unilateral-close change addresses.
2024-11-17 20:27:13 +10:30
Rusty Russell
836204b1f2
lightningd: use P2TR for anchor spends.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
Rusty Russell
ad1e9f7979
onchaind: don't get final_key_idx.
...
onchaind used to make its own txs, but doesn't any more. This
parameter is useless.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
ShahanaFarooqui
72345c5fbc
gitignore: Ignore chaneld_fakenet
2024-11-17 20:27:13 +10:30
Rusty Russell
c4cbb8671a
lightningd: actually deprecate old close fields.
...
Changelog-Deprecated: `close` `tx` and `txid` field (use `txs` and `txids`)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 16:04:06 +10:30
Rusty Russell
c79a89d557
pytest: adapt tests to avoid deprecated APIs in close (tx and txid).
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 16:04:06 +10:30
Dusty Daemon
809f3b01d9
close: Print multiple txs; Fixes #6467
...
Changelog-Changed: `close` now outputs txs & txids of all closing transactions (splice candidates can cause there to be multiple).
2024-11-17 16:04:06 +10:30
Dusty Daemon
4500661bbf
channeld: Add aggressive restart test
...
Changelog-None
2024-11-17 15:32:28 +10:30
niftynei
cb2163e439
bkpr: add bookkeeping assertions to splice in + out tests
...
Make sure that the fees and channel balances for splice ins and outs
work as expected.
Note this is for a single-sided splice.
Changelog-None: Tests!
2024-11-17 14:25:29 +10:30
Rusty Russell
fcebb33180
lightningd: deprecate decodepay.
...
It only works on BOLT11, and has long been replaced by the more
generic "decode".
Removing it will stop the confusion!
(Note: documentation claims it was introduced in 23.08, but that was
wrong, as it's been in CLN since the beginning).
[ Fixup from: niftynei <niftynei@gmail.com> ]
Fixes: https://github.com/ElementsProject/lightning/issues/6419
Changelog-Deprecated: JSON-RPC: `decodepay`: use `decode`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:21:23 +10:30
Rusty Russell
374db239be
Makefile: ensure that cln-grpc depends on msggen generated files.
...
Looks like a build race, where we use it before it's finished:
```
msggen cln-rpc/src/model.rs
error: this file contains an unclosed delimiter
--> cln-grpc/src/server.rs:3661:7
|
84 | {
| - unclosed delimiter
...
3661 | }
| ^
```
...
```
make: *** [plugins/Makefile:298: target/release/cln-grpc] Error 101
make: *** Waiting for unfinished jobs....
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
fffb381a40
lightningd: help memleak scan into replay_tx hash table to avoid false positives.
...
```
**BROKEN** lightningd: MEMLEAK: 0x5557327d1428
**BROKEN** lightningd: label=lightningd/onchain_control.c:352:struct replay_tx
**BROKEN** lightningd: alloc:
**BROKEN** lightningd: /home/runner/work/lightning/lightning/ccan/ccan/tal/tal.c:488 (tal_alloc_)
**BROKEN** lightningd: /home/runner/work/lightning/lightning/lightningd/onchain_control.c:352 (replay_watch_tx)
**BROKEN** lightningd: /home/runner/work/lightning/lightning/lightningd/onchain_control.c:1816 (onchaind_funding_spent)
**BROKEN** lightningd: /home/runner/work/lightning/lightning/lightningd/onchain_control.c:1860 (onchaind_replay_channels)
**BROKEN** lightningd: /home/runner/work/lightning/lightning/lightningd/lightningd.c:1407 (main)
**BROKEN** lightningd: parents:
**BROKEN** lightningd: lightningd/onchain_control.c:1856:struct replay_tx_hash
**BROKEN** lightningd: lightningd/lightningd.c:112:struct lightningd
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
7ed2126ee7
pytest: fix flake in test_fetchinvoice_disconnected_reply.
...
Fails when l3 doesn't know address for l1, to connect to it:
```
2024-11-16T04:45:42.2243366Z lightningd-3 2024-11-16T04:35:10.582Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: peer_in WIRE_ONION_MESSAGE
2024-11-16T04:45:42.2244342Z lightningd-3 2024-11-16T04:35:10.582Z DEBUG lightningd: Got onionmsg reply_path
2024-11-16T04:45:42.2245398Z lightningd-3 2024-11-16T04:35:10.582Z DEBUG plugin-offers: Note: disallowing deprecated onion_message_recv.blinding
2024-11-16T04:45:42.2246408Z lightningd-3 2024-11-16T04:35:10.586Z UNUSUAL plugin-offers: No incoming channel for 5msat, so no blinded path
2024-11-16T04:45:42.2247289Z lightningd-3 2024-11-16T04:35:10.605Z DEBUG hsmd: Client: Received message 25 from client
2024-11-16T04:45:42.2248372Z lightningd-3 2024-11-16T04:35:10.606Z DEBUG plugin-offers: connecting directly to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518
2024-11-16T04:45:42.2249451Z lightningd-3 2024-11-16T04:35:10.606Z DEBUG gossipd: REPLY WIRE_GOSSIPD_GET_ADDRS_REPLY with 0 fds
2024-11-16T04:45:42.2250743Z lightningd-3 2024-11-16T04:35:10.607Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: Failed connected out: Unable to connect, no address known for peer
```
This is because the test which was supposed to wait for addresses is
wrong: it passes when l3 knows nothing! (`all([])` == `True`)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
9af01b062c
pytest: fix hsmtool which reports leak under address sanitizer.
...
Couldn't figure out why hsmtool.proc.wait(WAIT_TIMEOUT) returns 1?
hsmtool doesn't ever seem to exit status 1!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30