Commit graph

2506 commits

Author SHA1 Message Date
daywalker90
248b3fae1a Makefile: call cargo for binary targets if workspace library dependencies changed
Changelog-None
2026-08-13 12:14:48 +02:00
daywalker90
62c1b705f2 cln-plugin: return rpc error instead of exiting on invalid json input
CLN is too permissive for serde_json when validating json:

`lightning-cli -k myplugin-cmd channels='[123456x1x0]'`

is valid for lightning-cli but is actually invalid json (bare token in array).

The cln-plugin decoder would error and end the FramedRead stream, causing the
PluginDriver loop to exit, and therefore exiting the plugin itself.

We need to recover the id from the invalid json with a separate parser to return a
json rpc error to CLN with the correct id so the rpc command does not hang.

Changelog-None
2026-08-13 12:14:14 +02:00
Rusty Russell
d7f87f2d46 fetchinvoice: handle weird labels in recurrence_label parameter.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
4348d8acf0 lightningd: don't do previous invoice checking in createinvoicerequest.
This is an undocumented interface, so we can just change it.

Rename "recurrence_label" to the more general "label", now we don't
require it to find previous payments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
3e49d908d2 fetchinvoice: don't bother with checking recurrence timing.
We don't actually need to enforce this check here: we can make that
the users' responsibility.  This simplifies our work quite a lot,
since createinvoicerequest won't have to do a lookup any more.

This can be done by the repeatpay plugin itself.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
a6cf4915e5 offers: limit expiry to offer limit, or 10 minutes with currency conversion.
This mirrors the previous commit, where we did it for recurring offers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Offers: we set a 10 minute expiry when we create invoices for offers in other currencies.
2026-08-04 18:51:43 -03:00
Rusty Russell
446312cf1b offers: limit invoices to 10 minutes for recurring offers in other currencies.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Lagrang3
76396dd4b7 askrene: explain failure: add known enabled case
Consider the case in which payment fails due to not enough "known enabled"
liquidity. Notice that we cover the "known" and "enabled" cases already.
But:
	known_enabled <= enabled
and
	known_enabled <= known

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-04 18:51:43 -03:00
Rusty Russell
b0a7a6a92b askrene: give clearer error codes.
Add PAY_INSUFFICIENT_FUNDS and PAY_ROUTE_NOT_FOUND, and give nice
detailed errors for those.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `getroutes` can now return PAY_INSUFFICIENT_FUNDS (215) and PAY_DESTINATION_INSUFFICIENT_CAPACITY (220) error codes.
2026-08-04 18:51:43 -03:00
Lagrang3
2a3feb7e35 askrene: safer iterating over changing htable
on trim_constraints:
to be sure we don't miss elements we add to the hash table after the
loop and not during iteration.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-04 18:51:43 -03:00
Lagrang3
ab9fd89a5b xpay: trim constraints: small optimization
Use a single realloc to remove old entries.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-04 18:51:43 -03:00
Lagrang3
8891f414a3 askrene: don't leak channel intel entries
On deletion of individual channel intel entries we need to free the
pointer inside the structure.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-04 18:51:43 -03:00
Rusty Russell
4b6fe4a161 askrene: correctly order constraints.
Pure "constraints" don't care about order (they simply clamp max and
min), but "impressions" are relative, so they do.  Change the
hashtable to keep them timestamp sorted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
a66fabd43e xpay: actually tell askrene when a payment succeeded.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
957696497a askrene: add APIs for "impressions" which are *relative* constraints.
Normal constraints are clamps on min/max caused by failed payments:
min for the channels that succeeded, max for the channel which failed.

Impressions are the results of successful payments, which alter both
min and max (negatively in the forward direction, positively in the
reverse).

impression: n
1. An effect, feeling, or image retained as a consequence of experience.
2. A vague notion, remembrance, or belief.
3. A mark produced on a surface by pressure.

Unlike constraints, this is the result of our own effect on the network: they're related
but different enough to get their own API and terminology.

The name conveys both we made an impression on the channel, and that
the results are a bit vague (due to other changes since then, which we
won't know about).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `askrene` layers now contain "impressions" representing the effects of successful payments we made through channels.
2026-08-04 18:51:43 -03:00
Rusty Russell
e0f86c17c6 common: hoist amount+currency parsing into common code.
Currently used for offers, we will use it for repeatpay too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
581bbb1fb8 common: hoist hash_str helper into its own header.
We have three uses already, about to add a fourth.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Lagrang3
dd65210505 libplugin: json_id: guard against weird prefixes
Following the recent enforcement of ids being printable strings
we put guards on "method" and "prefix" as well.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-04 18:51:43 -03:00
Rusty Russell
395f99d76a libplugins: JSON ids are always strings.
We used to handle it being a literal, but this was removed in
73fc9b0c2a (v25.05) so we don't need to handle that at all.

Not using the raw JSON means we handle weird methodnames by replacement: otherwise we would
not match the responses.  Only an issue for commando, where the command would time out
rather than report "Unknown method".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Rusty Russell
e13df371b0 multiwithdraw: use unique ids on requests.
Shades of `efacada7dd` which did the same thing in multifundchannel:
(ab)used the id, which being a string, gave and id of 34 (").

Also clean up the leftover assert in multifundchannel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-08-04 18:51:43 -03:00
Lagrang3
c48afd979c xpay: add sub-trace to measure injectpaymentonion
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-03 15:19:34 +02:00
Lagrang3
5870ffb8d7 xpay: added subtrace to measure getroutes
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-03 15:19:34 +02:00
Lagrang3
1e871ffd41 xpay: add traces for payments
Produce traces (see common/trace.h) for every payment in order to gather
statistics about the duration of a full payment execution.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-08-03 15:19:34 +02:00
bittylicious
835294919f plugins: recover awaiting channels after init
Some checks are pending
Continuous Integration / First Integration Tests (2/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (3/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (4/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (5/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (6/6) (push) Blocked by required conditions
Continuous Integration / Test CLN dual-fund Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN liquid Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN postgres Full Integration (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (1/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (10/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (11/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (12/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (2/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (3/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (4/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (5/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (6/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (7/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (8/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (9/12) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (1/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (2/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (3/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (4/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (5/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (6/6) (push) Blocked by required conditions
Continuous Integration / Update examples in doc schemas (push) Blocked by required conditions
Continuous Integration / Test minimum supported BTC v25.0 with clang (push) Blocked by required conditions
Continuous Integration / CI completion (push) Blocked by required conditions
Release Rust 🦀 / release_rust (push) Waiting to run
2026-07-26 14:21:44 +02:00
bittylicious
b2d3fd8494 plugins: defer spenderp awaiting-channel recovery 2026-07-26 14:21:44 +02:00
Lagrang3
9181505e55 renepay: fix CLTV value for the first hop
Changelog-Fixed: renepay: fix the computation of the CLTV for the first hop, it was double counting the current blockheight leading to too 900k blocks into the future.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-07-18 13:09:45 +02:00
daywalker90
8405796b8e msggen: new rust types for sat and sat_or_all
Also stop serializing amounts as string with msat suffix in cln-rpc
and serialize them as a raw number instead, like CLN does it

Changelog-None
2026-07-17 10:16:18 +02:00
Nicolas Dorier
cfb877a36e Improve reliability of wait_and_check_bitcoind
Some checks are pending
Continuous Integration / First Integration Tests (2/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (3/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (4/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (5/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (6/6) (push) Blocked by required conditions
Continuous Integration / Test CLN dual-fund Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN liquid Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN postgres Full Integration (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (1/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (10/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (11/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (12/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (2/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (3/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (4/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (5/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (6/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (7/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (8/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (9/12) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (1/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (2/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (3/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (4/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (5/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (6/6) (push) Blocked by required conditions
Continuous Integration / Update examples in doc schemas (push) Blocked by required conditions
Continuous Integration / Test minimum supported BTC v25.0 with clang (push) Blocked by required conditions
Continuous Integration / CI completion (push) Blocked by required conditions
Release Rust 🦀 / release_rust (push) Waiting to run
Changelog-Fixed: Fixed spurious bitcoind startup failures by retrying bitcoin-cli -rpcwait checks when RPC briefly fails.
2026-07-14 22:07:13 -03:00
daywalker90
678ff47d37 crates: update dependencies and upgrade quick-xml, tower-http, and tokio-tungstenite
```
cargo update
    Updating crates.io index
     Locking 62 packages to latest Rust 1.85.0 compatible versions
    Updating anyhow v1.0.102 -> v1.0.103
    Updating arc-swap v1.9.1 -> v1.9.2
    Updating arrayvec v0.7.6 -> v0.7.8
    Updating base58ck v0.1.100 -> v0.1.101
    Updating bitcoin v0.32.100 -> v0.32.101
      Adding bitcoin-consensus-encoding v1.0.0
      Adding bitcoin-internals v0.5.0
    Updating bitcoin-io v0.1.100 -> v0.1.101
    Updating bitcoin-units v0.1.100 -> v0.1.101
    Updating bitcoin_hashes v0.14.100 -> v0.14.101
      Adding block-buffer v0.12.1
    Updating bytes v1.11.1 -> v1.12.1
    Updating cc v1.2.64 -> v1.2.67
    Updating chacha20 v0.10.0 -> v0.10.1
      Adding const-oid v0.10.2
      Adding crypto-common v0.2.2
      Adding defmt v1.1.1
      Adding defmt-macros v1.1.1
      Adding defmt-parser v1.0.0
      Adding digest v0.11.3
    Updating env_filter v1.0.1 -> v2.0.0
    Updating env_logger v0.11.10 -> v0.11.11
    Updating fs-err v3.3.0 -> v3.3.1
    Updating getrandom v0.4.2 -> v0.4.3
      Adding hex-conservative v0.3.2
      Adding hybrid-array v0.4.13
    Removing id-arena v2.3.0
    Updating jiff v0.2.28 -> v0.2.32
    Updating jiff-static v0.2.28 -> v0.2.32
    Updating js-sys v0.3.102 -> v0.3.103
    Removing leb128fmt v0.1.0
    Updating lightning v0.1.8 -> v0.1.11
    Updating lightning-invoice v0.33.2 -> v0.33.3
    Updating lightning-types v0.2.0 -> v0.2.1
    Updating log v0.4.32 -> v0.4.33
    Updating memchr v2.8.2 -> v2.8.3
    Updating num-bigint v0.4.6 -> v0.4.8
    Updating possiblyrandom v0.2.0 -> v0.2.1
    Updating quote v1.0.45 -> v1.0.46
    Removing rand v0.9.4
    Removing rand v0.10.1
      Adding rand v0.9.5
      Adding rand v0.10.2
    Updating regex v1.12.4 -> v1.13.0
    Updating regex-automata v0.4.14 -> v0.4.15
    Updating rust-embed v8.11.0 -> v8.12.0
    Updating rust-embed-impl v8.11.0 -> v8.12.0
    Updating rust-embed-utils v8.11.0 -> v8.12.0
    Updating rustls v0.23.40 -> v0.23.41
    Updating rustls-pki-types v1.14.1 -> v1.15.0
    Updating rustversion v1.0.22 -> v1.0.23
    Updating sha1 v0.10.6 -> v0.10.7
    Updating sha2 v0.10.9 -> v0.11.0
    Updating syn v2.0.117 -> v2.0.118
    Updating thread_local v1.1.9 -> v1.1.10
    Removing unicode-xid v0.2.6
    Removing wasip3 v0.4.0+wasi-0.3.0-rc-2026-01-06
    Updating wasm-bindgen v0.2.125 -> v0.2.126
    Updating wasm-bindgen-futures v0.4.75 -> v0.4.76
    Updating wasm-bindgen-macro v0.2.125 -> v0.2.126
    Updating wasm-bindgen-macro-support v0.2.125 -> v0.2.126
    Updating wasm-bindgen-shared v0.2.125 -> v0.2.126
    Removing wasm-encoder v0.244.0
    Removing wasm-metadata v0.244.0
    Removing wasmparser v0.244.0
    Updating web-sys v0.3.102 -> v0.3.103
    Updating webpki-root-certs v1.0.7 -> v1.0.8
    Removing wit-bindgen v0.51.0
    Removing wit-bindgen-core v0.51.0
    Removing wit-bindgen-rust v0.51.0
    Removing wit-bindgen-rust-macro v0.51.0
    Removing wit-component v0.244.0
    Removing wit-parser v0.244.0
    Updating zerocopy v0.8.52 -> v0.8.54
    Updating zerocopy-derive v0.8.52 -> v0.8.54
    Updating zlib-rs v0.6.3 -> v0.6.6
    Updating zmij v1.0.21 -> v1.0.22
```

quick-xml upgraded to 0.41
tower-http upgraded to 0.7
tokio-tungstenite upgraded to 0.30

No code changes needed.

Changelog-None
2026-07-14 11:16:17 +02:00
daywalker90
17abce2450 lsps-plugin: print whole error chain for HtlcError 2026-07-06 19:25:22 +02:00
daywalker90
d94b37b84d cln-plugin: include the full error chain when given a context
Changelog-None
2026-07-06 19:25:22 +02:00
Lagrang3
aaefc60f1b listsendpays: discriminate ongoing payment by groupid
Some checks failed
Continuous Integration / First Integration Tests (3/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (4/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (5/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (6/6) (push) Blocked by required conditions
Continuous Integration / Test CLN dual-fund Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN liquid Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN postgres Full Integration (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (1/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (10/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (11/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (12/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (2/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (3/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (4/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (5/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (6/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (7/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (8/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (9/12) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (1/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (2/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (3/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (4/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (5/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (6/6) (push) Blocked by required conditions
Continuous Integration / Update examples in doc schemas (disabled temporarily!) (push) Blocked by required conditions
Continuous Integration / Test minimum supported BTC v25.0 with clang (push) Blocked by required conditions
Continuous Integration / CI completion (push) Blocked by required conditions
Release Rust 🦀 / release_rust (push) Waiting to run
ReadMe Sync / rdme-docs-sync (push) Has been cancelled
A payment attempt in listpays is defined as pair (payment hash, group id).
If we query xpay for ongoing payments we must discriminate
using both values.

Fixes flaky test tests/test_pay.py:test_sendpay_grouping
```
FAILED tests/test_pay.py::test_sendpay_grouping - AssertionError: assert ['pending', 'pending', 'complete'] == ['failed', 'failed', 'complete']
```

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-06-30 15:54:43 -04:00
daywalker90
47a22d2c82 currencyrate: vendor root certificates with webpki-roots
minimal setups without `ca-certificates` would cause cln-currencyrate to immediately exit with
`builder error`

We vendor the root certificates and improve the error message.

reported by @nepet

Changelog-Fixed: cln-currencyrate: include root certificates to fix the `builder error` on OS's without root certificates
2026-06-25 12:11:15 +09:30
Lagrang3
c7e7a5e492 getroutes: don't crash on source==destination
```
cln-askrene: plugins/askrene/child/child.c:40: final_hop: Assertion `tal_count(hops) > 0' failed.
cln-askrene: FATAL SIGNAL 6 (version v26.06-19-g46b039d)
lightningd-1 2026-06-15T12:34:26.296Z DEBUG   plugin-cln-askrene: notify msg debug: Final answer has 1 flows
0x55ab65429902 send_backtrace
	common/daemon.c:38
0x55ab6542998c crashdump
	common/daemon.c:83
0x7fbc84a8bdef ???
	./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fbc84ae095c __pthread_kill_implementation
	./nptl/pthread_kill.c:44
0x7fbc84a8bcc1 __GI_raise
	../sysdeps/posix/raise.c:26
0x7fbc84a744ab __GI_abort
	./stdlib/abort.c:77
0x7fbc84a7441f __assert_fail_base
	./assert/assert.c:118
0x55ab6541b60c final_hop
	plugins/askrene/child/child.c:40
0x55ab6541b70d fmt_route
	plugins/askrene/child/child.c:48
0x55ab6541ba5b convert_flows_to_routes
	plugins/askrene/child/child.c:135
0x55ab6541c037 run_child
	plugins/askrene/child/child.c:265
0x55ab65416caa do_getroutes
	plugins/askrene/askrene.c:711
0x55ab65416d28 begin_request
	plugins/askrene/askrene.c:887
0x55ab654170a2 json_getroutes
	plugins/askrene/askrene.c:968
0x55ab654285ec ld_command_handle
	plugins/libplugin.c:2206
0x55ab654287f6 ld_read_json
	plugins/libplugin.c:2282
0x55ab65439261 next_plan
	ccan/ccan/io/io.c:60
0x55ab65439580 do_plan
	ccan/ccan/io/io.c:422
0x55ab65439639 io_ready
	ccan/ccan/io/io.c:439
0x55ab6543a5fc io_loop
	ccan/ccan/io/poll.c:470
0x55ab65428bc4 plugin_main
	plugins/libplugin.c:2481
0x55ab65417491 main
	plugins/askrene/askrene.c:1551
0x7fbc84a75ca7 __libc_start_call_main
	../sysdeps/nptl/libc_start_call_main.h:58
0x7fbc84a75d64 __libc_start_main_impl
	../csu/libc-start.c:360
0x55ab65413920 ???
	_start+0x20:0
0xffffffffffffffff ???
	???:0
```

Changelog-Fixed: askrene-getroutes: don't crash on invalid user input, source==destination

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-06-18 13:20:16 +09:30
Lagrang3
9e8f4ffd59 xpay: age layer before payment instead on timer
We use to call askrene-age on xpay layer every 60 seconds to remove old
entries. But for payments to discard old entries it is enough to call
askrene-age before getroutes. True as long as:

age(t1) * age(t2) * ... * age(tN) = age(tN)

Reduces flakyness caused by xpay failing to call askrene-age during lightningd shutdown.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-06-17 22:34:31 +09:30
Lagrang3
fdb6df88eb xpay: clean preapprove*_succeed functions
preapproveinvoice_succeed and preapprovekeysend_succeed
do the same thing: acknowledge that preapproval rpc call have succeeded
and continue the payment execution via populate_private_layers.
Therefore we use a unique function for both cases: preapprove_succeed.

Changelog-None.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-06-17 22:34:31 +09:30
daywalker90
e33f9e3c93 cln-subscribe-wildcard: properly handle shutdown notification with an exit
this would cause pytest teardowns to take the full timeout of killing a plugin
that should exit themselves

Changelog-None
2026-06-17 18:49:59 +09:30
daywalker90
fe0c452235 cargo: update dependencies
cargo update output:
    Updating bitflags v2.11.1 -> v2.13.0
    Updating cc v1.2.63 -> v1.2.64
    Updating chrono v0.4.44 -> v0.4.45
    Updating h2 v0.4.14 -> v0.4.15
    Updating http v1.4.1 -> v1.4.2
    Updating js-sys v0.3.99 -> v0.3.102
    Updating log v0.4.30 -> v0.4.32
    Updating memchr v2.8.1 -> v2.8.2
    Updating prost v0.14.3 -> v0.14.4
    Updating prost-build v0.14.3 -> v0.14.4
    Updating prost-derive v0.14.3 -> v0.14.4
    Updating prost-types v0.14.3 -> v0.14.4
    Updating regex v1.12.3 -> v1.12.4
    Updating regex-syntax v0.8.10 -> v0.8.11
    Updating rustls-native-certs v0.8.3 -> v0.8.4
    Updating smallvec v1.15.1 -> v1.15.2
    Updating wasm-bindgen v0.2.122 -> v0.2.125
    Updating wasm-bindgen-futures v0.4.72 -> v0.4.75
    Updating wasm-bindgen-macro v0.2.122 -> v0.2.125
    Updating wasm-bindgen-macro-support v0.2.122 -> v0.2.125
    Updating wasm-bindgen-shared v0.2.122 -> v0.2.125
    Updating web-sys v0.3.99 -> v0.3.102
    Updating yoke v0.8.2 -> v0.8.3
    Updating zerocopy v0.8.50 -> v0.8.52
    Updating zerocopy-derive v0.8.50 -> v0.8.52
    Updating zeroize v1.8.2 -> v1.9.0

Also upgraded quick-xml to 0.40

Changelog-None
2026-06-16 12:56:50 +02:00
daywalker90
9770077494 currencyrate: propagate http errors to currencyrate rpc if a source is provided
specifically coindesk was constantly hitting API rate limits causing our tests to fail
so lets unit tests all endpoints with a snapshot of real responses and only allow for http
error 401/429 in integration tests

Also fix a flake in test_bkpr_currencyrate_persisted that would pick up a cached rate from CLN's own caching

Changelog-None
2026-06-10 14:26:41 +02:00
Sangbida Chaudhuri
1c346a5107 plugins: rename bwatch output binary to cln-bwatch
The bwatch plugin lived in plugins/bwatch/ and output its binary as
plugins/bwatch/bwatch. This caused make install to install it flat as
<plugindir>/bwatch, while lightningd expected it at <plugindir>/bwatch/bwatch, so plugin registration failed at startup with "failed to register plugin".

Fix by renaming the output to plugins/cln-bwatch, following the same
convention as cln-renepay, cln-xpay and cln-askrene.

Changelog-Fixed: bwatch plugin failed to register on startup after make install
2026-06-05 12:03:38 +02:00
Rusty Russell
703d737dd5 xpay: don't crash on circular routehints.
We earlier fixed the cases of gossipd inserting a same-node channel,
but didn't prevent it for local modifications:

```
cln-askrene: common/gossmap.c:52: nodeidx_htable_add: Assertion `!nodeidx_htable_getmatch_(ht, k, h, v, &i)' failed.
cln-askrene: FATAL SIGNAL 6 (version v26.06rc2-5-gd389c3f-modded)
0x5c50e80dd5cb send_backtrace
        common/daemon.c:38
0x5c50e80dd685 crashdump
        common/daemon.c:83
0x70a5b1e4532f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x70a5b1e9eb2c __pthread_kill_implementation
        ./nptl/pthread_kill.c:44
0x70a5b1e9eb2c __pthread_kill_internal
        ./nptl/pthread_kill.c:78
0x70a5b1e9eb2c __GI___pthread_kill
        ./nptl/pthread_kill.c:89
0x70a5b1e4527d __GI_raise
        ../sysdeps/posix/raise.c:26
0x70a5b1e288fe __GI_abort
        ./stdlib/abort.c:79
0x70a5b1e2881a __assert_fail_base
        ./assert/assert.c:96
0x70a5b1e3b516 __assert_fail
        ./assert/assert.c:105
0x5c50e80dfb44 nodeidx_htable_add
        common/gossmap.c:52
0x5c50e80e1066 add_channel
        common/gossmap.c:515
0x5c50e80e327c gossmap_apply_localmods
        common/gossmap.c:1239
0x5c50e80bed55 do_getroutes
        plugins/askrene/askrene.c:620
0x5c50e80bf919 listpeerchannels_done
```

Reported-by: Won Hoi Kim and Ahmad Elmoursi
Changelog-Fixed: Plugins: xpay no longer crashes on circular bolt11 routehints.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-06-01 11:40:01 +02:00
Rusty Russell
8db2c28d78 xpay: print rejected currency correctly.
Reported-by: Won Hoi Kim and Ahmad Elmoursi
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-06-01 11:40:01 +02:00
daywalker90
55ab6e7ddc crates: bump cln-rpc, cln-grpc and cln-plugin to v0.7.0 for release
Changelog-None
2026-05-25 17:32:59 +02:00
Christian Decker
73825bca71 renepay: skip channels disabled in gossmap
channel_is_available() checked whether a channel_update existed
(gossmap_chan_set) and whether renepay's own disabledmap had flagged
it, but never checked gossmap's half_chan.enabled flag.  This meant
renepay would route through channels marked disabled in the
gossip_store, wasting HTLC round-trips to re-discover the failure.

Changelog-Fixed: renepay now skips channels disabled in the gossip map.
2026-05-18 15:34:59 +02:00
daywalker90
6d98b486b3 gitignore: add bwatch
Changelog-None
2026-05-18 11:29:50 +09:30
enaples
fdce48703a currencyrate: added README
Changelog-None
2026-05-11 15:06:41 +02:00
enaples
6175642e72 currencyrate: round to the third digit and adding source argument to currencyrate command
Changelog-None
2026-05-11 15:06:41 +02:00
Lagrang3
bd71651b3c xpay: add sendamount command
Changelog-Added: sendamount command, to make a payment specifying the desired amount to send instead of the amount to be received.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-05-11 20:29:39 +09:30
Rusty Russell
ae956f2a7b xpay: fix taken leak if we fail xpay_core early.
This was uncovered by a test in the next commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-05-11 20:29:39 +09:30
Lagrang3
1f55feec4a xpay: add a special offer payable condition ...
that only applies to sendamount payments (includefees flag on).

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2026-05-11 20:29:39 +09:30