Skip to content

Commit 3b16c77

Browse files
authored
Merge pull request #3999 from valentinewallace/2025-08-3618-followups
#3618 followups + expose async receive feature
2 parents efb8d58 + c0b8a44 commit 3b16c77

File tree

18 files changed

+463
-541
lines changed

18 files changed

+463
-541
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ check-cfg = [
6666
"cfg(taproot)",
6767
"cfg(require_route_graph_test)",
6868
"cfg(splicing)",
69-
"cfg(async_payments)",
7069
"cfg(simple_close)",
7170
]

fuzz/src/full_stack.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,9 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
11711171
ext_from_hex("030120", &mut test);
11721172
// init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac
11731173
ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 01000000000000000000000000000000", &mut test);
1174+
// One feerate request on peer connection due to a list_channels call when seeing if the async
1175+
// receive offer cache needs updating
1176+
ext_from_hex("00fd", &mut test);
11741177

11751178
// create outbound channel to peer 1 for 50k sat
11761179
ext_from_hex(

lightning/src/blinded_path/message.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,9 @@ pub enum AsyncPaymentsContext {
506506
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
507507
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
508508
offer_id: OfferId,
509-
/// The time as duration since the Unix epoch at which this path expires and messages sent over
510-
/// it should be ignored. If we receive confirmation of an invoice over this path after its
511-
/// expiry, it may be outdated and a new invoice update should be sent instead.
512-
path_absolute_expiry: core::time::Duration,
509+
/// The time as duration since the Unix epoch at which the invoice corresponding to this path
510+
/// was created. Useful to know when an invoice needs replacement.
511+
invoice_created_at: core::time::Duration,
513512
},
514513
/// Context contained within the reply [`BlindedMessagePath`] we put in outbound
515514
/// [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`]
@@ -577,7 +576,7 @@ impl_writeable_tlv_based_enum!(AsyncPaymentsContext,
577576
},
578577
(3, StaticInvoicePersisted) => {
579578
(0, offer_id, required),
580-
(2, path_absolute_expiry, required),
579+
(2, invoice_created_at, required),
581580
},
582581
(4, OfferPathsRequest) => {
583582
(0, recipient_id, required),

lightning/src/events/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,6 @@ pub enum Event {
16341634
///
16351635
/// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
16361636
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
1637-
#[cfg(async_payments)]
16381637
PersistStaticInvoice {
16391638
/// The invoice that should be persisted and later provided to payers when handling a future
16401639
/// [`Event::StaticInvoiceRequested`].
@@ -1651,6 +1650,8 @@ pub enum Event {
16511650
///
16521651
/// When an [`Event::StaticInvoiceRequested`] comes in for the invoice, this id will be surfaced
16531652
/// and can be used alongside the `invoice_id` to retrieve the invoice from the database.
1653+
///
1654+
///[`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
16541655
recipient_id: Vec<u8>,
16551656
/// A random identifier for the invoice. When an [`Event::StaticInvoiceRequested`] comes in for
16561657
/// the invoice, this id will be surfaced and can be used alongside the `recipient_id` to
@@ -1682,7 +1683,6 @@ pub enum Event {
16821683
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
16831684
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
16841685
/// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1685-
#[cfg(async_payments)]
16861686
StaticInvoiceRequested {
16871687
/// An identifier for the recipient previously surfaced in
16881688
/// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_id` to
@@ -2175,13 +2175,11 @@ impl Writeable for Event {
21752175
(8, former_temporary_channel_id, required),
21762176
});
21772177
},
2178-
#[cfg(async_payments)]
21792178
&Event::PersistStaticInvoice { .. } => {
21802179
45u8.write(writer)?;
21812180
// No need to write these events because we can just restart the static invoice negotiation
21822181
// on startup.
21832182
},
2184-
#[cfg(async_payments)]
21852183
&Event::StaticInvoiceRequested { .. } => {
21862184
47u8.write(writer)?;
21872185
// Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
@@ -2768,10 +2766,8 @@ impl MaybeReadable for Event {
27682766
}))
27692767
},
27702768
// Note that we do not write a length-prefixed TLV for PersistStaticInvoice events.
2771-
#[cfg(async_payments)]
27722769
45u8 => Ok(None),
27732770
// Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events.
2774-
#[cfg(async_payments)]
27752771
47u8 => Ok(None),
27762772
// Note that we do not write a length-prefixed TLV for FundingTransactionReadyForSigning events.
27772773
49u8 => Ok(None),

0 commit comments

Comments
 (0)