Skip to content

#3618 followups + expose async receive feature #3999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ check-cfg = [
"cfg(taproot)",
"cfg(require_route_graph_test)",
"cfg(splicing)",
"cfg(async_payments)",
"cfg(simple_close)",
]
3 changes: 3 additions & 0 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,9 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac
ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 01000000000000000000000000000000", &mut test);
// One feerate request on peer connection due to a list_channels call when seeing if the async
// receive offer cache needs updating
ext_from_hex("00fd", &mut test);

// create outbound channel to peer 1 for 50k sat
ext_from_hex(
Expand Down
9 changes: 4 additions & 5 deletions lightning/src/blinded_path/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,9 @@ pub enum AsyncPaymentsContext {
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
offer_id: OfferId,
/// The time as duration since the Unix epoch at which this path expires and messages sent over
/// it should be ignored. If we receive confirmation of an invoice over this path after its
/// expiry, it may be outdated and a new invoice update should be sent instead.
path_absolute_expiry: core::time::Duration,
/// The time as duration since the Unix epoch at which the invoice corresponding to this path
/// was created. Useful to know when an invoice needs replacement.
invoice_created_at: core::time::Duration,
},
/// Context contained within the reply [`BlindedMessagePath`] we put in outbound
/// [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`]
Expand Down Expand Up @@ -577,7 +576,7 @@ impl_writeable_tlv_based_enum!(AsyncPaymentsContext,
},
(3, StaticInvoicePersisted) => {
(0, offer_id, required),
(2, path_absolute_expiry, required),
(2, invoice_created_at, required),
},
(4, OfferPathsRequest) => {
(0, recipient_id, required),
Expand Down
8 changes: 2 additions & 6 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,6 @@ pub enum Event {
///
/// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
#[cfg(async_payments)]
PersistStaticInvoice {
/// The invoice that should be persisted and later provided to payers when handling a future
/// [`Event::StaticInvoiceRequested`].
Expand All @@ -1645,6 +1644,8 @@ pub enum Event {
///
/// When an [`Event::StaticInvoiceRequested`] comes in for the invoice, this id will be surfaced
/// and can be used alongside the `invoice_id` to retrieve the invoice from the database.
///
///[`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
recipient_id: Vec<u8>,
/// A random identifier for the invoice. When an [`Event::StaticInvoiceRequested`] comes in for
/// the invoice, this id will be surfaced and can be used alongside the `recipient_id` to
Expand Down Expand Up @@ -1676,7 +1677,6 @@ pub enum Event {
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
/// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
#[cfg(async_payments)]
StaticInvoiceRequested {
/// An identifier for the recipient previously surfaced in
/// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_id` to
Expand Down Expand Up @@ -2123,13 +2123,11 @@ impl Writeable for Event {
(8, former_temporary_channel_id, required),
});
},
#[cfg(async_payments)]
&Event::PersistStaticInvoice { .. } => {
45u8.write(writer)?;
// No need to write these events because we can just restart the static invoice negotiation
// on startup.
},
#[cfg(async_payments)]
&Event::StaticInvoiceRequested { .. } => {
47u8.write(writer)?;
// Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
Expand Down Expand Up @@ -2711,10 +2709,8 @@ impl MaybeReadable for Event {
}))
},
// Note that we do not write a length-prefixed TLV for PersistStaticInvoice events.
#[cfg(async_payments)]
45u8 => Ok(None),
// Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events.
#[cfg(async_payments)]
47u8 => Ok(None),
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
Expand Down
Loading
Loading