Repository navigation
Makefile gen fix - #4
Merged
Merged
Conversation
Changelog-None
This mistake was revealed when we start using experimental range for recurrence (next commit). Signed-off-by: Rusty Russell <[email protected]>
The `invreq_recurrence_counter` clashes with the coming addition of invreq_paths, so we might as well move them all to the new experimental ranges. Changelog-EXPERIMENTAL: Recurring offers had incompatible changes, won't work against older versions. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…ecated. Signed-off-by: Rusty Russell <[email protected]>
This is the blinded path for offerless invoice_requests. Signed-off-by: Rusty Russell <[email protected]>
This is a good idea, but also specifically called out in the latest BOLT spec. Signed-off-by: Rusty Russell <[email protected]>
The latest spec allows this to be omitted iff there is a blinded path and it would be made up anyway. In that case, the key they will use to sign the invoice will be the final blinded key in the path we use. Signed-off-by: Rusty Russell <[email protected]>
…rectly. 1. Missing offer_description iff offer_amount also missing. 2. Missing offer_issuer_id iff offer_paths is present. 3. Short channel id on introduction point. 4. Experimental range. Signed-off-by: Rusty Russell <[email protected]>
invoice_path_id is actually a generic path_id thing, so rename it. We're going to use the same scheme for path secrets and the tweak to node_id when we create a fake pubkey for invoice_requests, so a new header is appropriate. Signed-off-by: Rusty Russell <[email protected]>
For now we only use a fake id for requesting invoices (as a payer_key), but we will eventually use this generically, and we want plugins to be able to map them too, so use the same scheme as path_id: a generated secret using the makesecret API. Signed-off-by: Rusty Russell <[email protected]>
… our key. The current interface, if given a tweak, uses a *different secret key* and tweaks it. This was an early experiment: we will switch to using a secret tweak for invoice_requests like we do for invoice path ids. To make sure there's no funny business, *hsmd* hashes to form the tweak (i.e. no zero tweaks!). Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…ng invoices. This is going to allow us to move it out from lightingd into plugin, easily. It's legal because the combination of offer id and label must be unique (with recurrence, we use the same metadata anyay, since they want to correlate with prior payments anyway). We already broke recurrence in this PR, so we don't need another note to say we're changing the key derivation. Signed-off-by: Rusty Russell <[email protected]>
They can do it now: before it would have been awkward to look up previous payments to match it up for recurring offers (which need to use the same key, hence the same invreq_metadata). Signed-off-by: Rusty Russell <[email protected]>
…request`. It's an internal difference, so doesn't actually break compatibility (it would if we tried to prove we owned an old invoicerequest, but we don't have infrastructure for that anyway). Signed-off-by: Rusty Russell <[email protected]>
…or createinvoicerequest. It's an internal undocumented interface, which makes this change less painful. We *do* check that the invreq_metadata maps to the given invreq_payer_id, which would is required for us to sign it. Signed-off-by: Rusty Russell <[email protected]>
…necessary. Changelog-EXPERIMENTAL: offers: `invoicerequest` will set a blinded path if we're an unannounced node. Changelog-EXPERIMENTAL: offers: `sendinvoice` will use a blinded path in an invoice_request, if specified. Signed-off-by: Rusty Russell <[email protected]>
This is a final sweep to match the current BOLT12 text:
1563d13999d342680140c693de0b9d65aa522372 ("More bolt12 test vectors.")
Only two code changes, to change the order of checks to match the bolt,
and to give a warning on decode if a path is empty.
Signed-off-by: Rusty Russell <[email protected]>
… exists. This was confusing to debug, but if the peer already exists we must not create a second one. Signed-off-by: Rusty Russell <[email protected]>
We ask each channeld to report its leaks, and keep a refcount of how many are outstanding. When the channeld replies, or dies, we decrement the count in a destructor. But if the last channeld we're waiting for dies, we can call the destructor in an unexpected place, and thus run leak detection when we were partway through some operation, which gives a false positive. Here's a backtrace showing it: ``` 0x5f93405897e3 send_backtrace common/daemon.c:33 0x5f93405381cf finish_report lightningd/memdump.c:139 0x5f93405382a0 leak_detect_req_done lightningd/memdump.c:172 0x5f9340705c41 notify ccan/ccan/tal/tal.c:243 0x5f9340705ca5 del_tree ccan/ccan/tal/tal.c:437 0x5f9340705ce8 del_tree ccan/ccan/tal/tal.c:447 0x5f93407061f3 tal_free ccan/ccan/tal/tal.c:532 0x5f9340563f5a subd_release_channel lightningd/subd.c:924 0x5f934050fb91 channel_set_owner lightningd/channel.c:31 0x5f9340511b84 channel_err lightningd/channel.c:1081 0x5f93405121a3 channel_fail_transient lightningd/channel.c:1095 0x5f934054e547 peer_channels_cleanup lightningd/peer_control.c:187 0x5f9340550411 peer_connected lightningd/peer_control.c:1689 0x5f9340525101 connectd_msg lightningd/connect_control.c:629 ``` Instead, do the lightningd detection up-front, where it's in a clean environment. Reported-by: Shahana Farooqui Signed-off-by: Rusty Russell <[email protected]>
In CI, this would sometimes fail: we would timeout waiting for the fetchinvoice reply. Never happened locally, so was annoying to debug. What happened was simple: we called injectonionmessage then when it returned, put the "sent" object in the linked list so we could recognize any reply onion messages. However, we were getting that reply before the plugin processed the response to injectonionmessage. This is possible because there are two fds for plugins: one for it to receive notifications and hooks (like onion messages) and one for normal RPC usage (like commands to inject onion messages). The fix is simple: put in the list *before* calling JSON RPC. Signed-off-by: Rusty Russell <[email protected]>
```
> warnings.warn(f"Error reporting testrun: {e}: {e.read()}")
E AttributeError: 'URLError' object has no attribute 'read'
```
Signed-off-by: Rusty Russell <[email protected]>
Changelog-None
rustyrussell
added a commit
that referenced
this pull request
Nov 10, 2025
And add a check for new uses creeping in, since it got cut & paste
everywhere.
This means "this is a valid string, but truncate it to this many characters"
vs "%.*s" which means "only read this many characters of string":
```
['lightningd-3 2025-10-23T02:31:40.890Z **BROKEN** plugin-funder: Plugin marked as important, shutting down lightningd!']
--------------------------- Captured stderr teardown ---------------------------
#0 0x557da58ad1dc in printf_common(void*, char const*, __va_list_tag*) asan_interceptors.cpp.o
#1 0x557da5aff814 in json_out_addv /home/runner/work/lightning/lightning/ccan/ccan/json_out/json_out.c:239:11
#2 0x557da59740ce in plugin_logv /home/runner/work/lightning/lightning/plugins/libplugin.c:1777:2
#3 0x557da5969b6f in plugin_log /home/runner/work/lightning/lightning/plugins/libplugin.c:1934:2
#4 0x557da595c4f6 in datastore_del_success /home/runner/work/lightning/lightning/plugins/funder.c:161:2
#5 0x557da598b837 in handle_rpc_reply /home/runner/work/lightning/lightning/plugins/libplugin.c:1072:10
#6 0x557da598a4b0 in rpc_conn_read_response /home/runner/work/lightning/lightning/plugins/libplugin.c:1361:3
#7 0x557da5adbea5 in next_plan /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:60:9
#8 0x557da5ae06ff in do_plan /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:422:8
#9 0x557da5adfb58 in io_ready /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:439:10
#10 0x557da5aec2ce in io_loop /home/runner/work/lightning/lightning/ccan/ccan/io/poll.c:455:5
#11 0x557da59757ac in plugin_main /home/runner/work/lightning/lightning/plugins/libplugin.c:2409:3
#12 0x557da594fe23 in main /home/runner/work/lightning/lightning/plugins/funder.c:1723:2
#13 0x7f6572229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#14 0x7f6572229e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#15 0x557da588b584 in _start (/home/runner/work/lightning/lightning/plugins/funder+0x10d584) (BuildId: 71ba63ab577fc6fa60573d3e8555f6db7d5c584d)
0x624000009d28 is located 0 bytes to the right of 7208-byte region [0x624000008100,0x624000009d28)
allocated by thread T0 here:
#0 0x557da590e7f6 in __interceptor_realloc (/home/runner/work/lightning/lightning/plugins/funder+0x1907f6) (BuildId: 71ba63ab577fc6fa60573d3e8555f6db7d5c584d)
#1 0x557da5b2149b in tal_resize_ /home/runner/work/lightning/lightning/ccan/ccan/tal/tal.c:755:13
#2 0x557da59f2032 in membuf_tal_resize /home/runner/work/lightning/lightning/common/utils.c:203:2
#3 0x557da5b03934 in membuf_prepare_space_ /home/runner/work/lightning/lightning/ccan/ccan/membuf/membuf.c:45:12
#4 0x557da59d4289 in jsonrpc_io_read_ /home/runner/work/lightning/lightning/common/jsonrpc_io.c:127:2
#5 0x557da598a635 in rpc_conn_read_response /home/runner/work/lightning/lightning/plugins/libplugin.c:1366:9
#6 0x557da5adbea5 in next_plan /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:60:9
#7 0x557da5ae06ff in do_plan /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:422:8
#8 0x557da5adfb58 in io_ready /home/runner/work/lightning/lightning/ccan/ccan/io/io.c:439:10
#9 0x557da5aec2ce in io_loop /home/runner/work/lightning/lightning/ccan/ccan/io/poll.c:455:5
#10 0x557da59757ac in plugin_main /home/runner/work/lightning/lightning/plugins/libplugin.c:2409:3
#11 0x557da594fe23 in main /home/runner/work/lightning/lightning/plugins/funder.c:1723:2
#12 0x7f6572229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: heap-buffer-overflow asan_interceptors.cpp.o in printf_common(void*, char const*, __va_list_tag*)
Shadow bytes around the buggy address:
0x0c487fff9350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c487fff9360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c487fff9370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c487fff9380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c487fff9390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c487fff93a0: 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa
0x0c487fff93b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c487fff93c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c487fff93d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c487fff93e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c487fff93f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==26122==ABORTING
```
Signed-off-by: Rusty Russell <[email protected]>
daywalker90
pushed a commit
that referenced
this pull request
Nov 5, 2026
check-source-bolt reads any "BOLT #4" comment as a spec quote, and this one isn't. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 893ec0f55d77825def0b805536e5693d65bff2f4)
daywalker90
added a commit
that referenced
this pull request
Nov 10, 2026
BOLT #4 allows a node that does not provide a channel_update in an UPDATE-flagged failure to set its len to zero, so we stop sending one for temporary_channel_failure. We only do this for temporary_channel_failure. lnd's decoder (checked on lnd master) accepts len=0 for that code only. For fee_insufficient, amount_below_minimum, incorrect_cltv_expiry and expiry_too_soon it fails to decode, so lnd penalizes the whole reporting node instead of the channel. Those codes keep their channel_update. channeld's amount_below_minimum and incorrect_cltv_expiry used to get their update appended after a len=0 field, which lnd cannot decode. We now rebuild them with the update inside the message. For incorrect_cltv_expiry we report the outgoing HTLC's cltv_expiry, as BOLT #4 specifies and eclair does. lnd and LDK report the incoming value instead, so implementations differ here. Disabling a channel when its peer disconnects used to happen as a side effect of building the update for a failure. It is now done directly: we disable our own direction in channel_gossip_channel_disconnect() and re-enable it in channel_gossip_channel_reestablished(). test_xpay_get_error_with_update now injects the channel_update through an inline plugin, as its offline-peer failure no longer carries one. test_gossip_disable_on_disconnect_own_direction checks the disable bit. Changelog-Changed: Protocol: temporary_channel_failure onion errors no longer include channel_update (BOLT #4). Changelog-Fixed: Protocol: amount_below_minimum and incorrect_cltv_expiry onion errors from channeld carry the channel_update inside the message, so lnd can decode them.
daywalker90
added a commit
that referenced
this pull request
Nov 10, 2026
BOLT #4 allows a node that does not provide a channel_update in an UPDATE-flagged failure to set its len to zero, so we stop sending one for temporary_channel_failure. We only do this for temporary_channel_failure. lnd's decoder (checked on lnd master) accepts len=0 for that code only. For fee_insufficient, amount_below_minimum, incorrect_cltv_expiry and expiry_too_soon it fails to decode, so lnd penalizes the whole reporting node instead of the channel. Those codes keep their channel_update. channeld's amount_below_minimum and incorrect_cltv_expiry used to get their update appended after a len=0 field, which lnd cannot decode. We now rebuild them with the update inside the message. For incorrect_cltv_expiry we report the outgoing HTLC's cltv_expiry, as BOLT #4 specifies and eclair does. lnd and LDK report the incoming value instead, so implementations differ here. Disabling a channel when its peer disconnects used to happen as a side effect of building the update for a failure. It is now done directly: we disable our own direction in channel_gossip_channel_disconnect() and re-enable it in channel_gossip_channel_reestablished(). test_xpay_get_error_with_update now injects the channel_update through an inline plugin, as its offline-peer failure no longer carries one. test_gossip_disable_on_disconnect_own_direction checks the disable bit. Changelog-Changed: Protocol: temporary_channel_failure onion errors no longer include channel_update (BOLT #4). Changelog-Fixed: Protocol: amount_below_minimum and incorrect_cltv_expiry onion errors from channeld carry the channel_update inside the message, so lnd can decode them.
daywalker90
added a commit
that referenced
this pull request
Nov 10, 2026
BOLT #4 allows a node that does not provide a channel_update in an UPDATE-flagged failure to set its len to zero, so we stop sending one for temporary_channel_failure. We only do this for temporary_channel_failure. lnd's decoder (checked on lnd master) accepts len=0 for that code only. For fee_insufficient, amount_below_minimum, incorrect_cltv_expiry and expiry_too_soon it fails to decode, so lnd penalizes the whole reporting node instead of the channel. Those codes keep their channel_update. channeld's amount_below_minimum and incorrect_cltv_expiry used to get their update appended after a len=0 field, which lnd cannot decode. We now rebuild them with the update inside the message. For incorrect_cltv_expiry we report the outgoing HTLC's cltv_expiry, as BOLT #4 specifies and eclair does. lnd and LDK report the incoming value instead, so implementations differ here. Disabling a channel when its peer disconnects used to happen as a side effect of building the update for a failure. It is now done directly: we disable our own direction in channel_gossip_channel_disconnect() and re-enable it in channel_gossip_channel_reestablished(). test_xpay_get_error_with_update now injects the channel_update through an inline plugin, as its offline-peer failure no longer carries one. test_gossip_disable_on_disconnect_own_direction checks the disable bit. Changelog-Changed: Protocol: temporary_channel_failure onion errors no longer include channel_update (BOLT #4). Changelog-Fixed: Protocol: amount_below_minimum and incorrect_cltv_expiry onion errors from channeld carry the channel_update inside the message, so lnd can decode them.
daywalker90
added a commit
that referenced
this pull request
Nov 26, 2026
BOLT #4 allows a node that does not provide a channel_update in an UPDATE-flagged failure to set its len to zero, so we stop sending one for temporary_channel_failure. We only do this for temporary_channel_failure. lnd's decoder (checked on lnd master) accepts len=0 for that code only. For fee_insufficient, amount_below_minimum, incorrect_cltv_expiry and expiry_too_soon it fails to decode, so lnd penalizes the whole reporting node instead of the channel. Those codes keep their channel_update. channeld's amount_below_minimum and incorrect_cltv_expiry used to get their update appended after a len=0 field, which lnd cannot decode. We now rebuild them with the update inside the message. For incorrect_cltv_expiry we report the outgoing HTLC's cltv_expiry, as BOLT #4 specifies and eclair does. lnd and LDK report the incoming value instead, so implementations differ here. Disabling a channel when its peer disconnects used to happen as a side effect of building the update for a failure. It is now done directly: we disable our own direction in channel_gossip_channel_disconnect() and re-enable it in channel_gossip_channel_reestablished(). Remove `test_xpay_get_error_with_update`, as `temporary_channel_failure` no longer carries a `channel_update` and `test_xpay_error_update_fees` already covers `xpay` handling a `channel_update` in an error. `test_gossip_disable_on_disconnect_own_direction` checks the disable bit. Changelog-Changed: Protocol: temporary_channel_failure onion errors no longer include channel_update (BOLT #4). Changelog-Fixed: Protocol: amount_below_minimum and incorrect_cltv_expiry onion errors from channeld carry the channel_update inside the message, so lnd can decode them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.