Skip to content

Commit 974aa69

Browse files
committed
Add PersistenceNotifierGuard take to offer/refund payments
This resolves an issue where offer and refund payments get delayed while we wait for the `invoice_request`/`invoice` onion messages to get sent. It further ensures we're likely to have the `ChannelManager` persisted with the new payment info after initiating the send/receive.
1 parent c4ba373 commit 974aa69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lightning/src/ln/channelmanager.rs

+6
Original file line numberDiff line numberDiff line change
@@ -7682,6 +7682,8 @@ where
76827682
.absolute_expiry(absolute_expiry)
76837683
.path(path);
76847684

7685+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7686+
76857687
let expiration = StaleExpiration::AbsoluteTimeout(absolute_expiry);
76867688
self.pending_outbound_payments
76877689
.add_new_awaiting_invoice(
@@ -7772,6 +7774,8 @@ where
77727774
let invoice_request = builder.build_and_sign()?;
77737775
let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
77747776

7777+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7778+
77757779
let expiration = StaleExpiration::TimerTicks(1);
77767780
self.pending_outbound_payments
77777781
.add_new_awaiting_invoice(
@@ -7833,6 +7837,8 @@ where
78337837
let amount_msats = refund.amount_msats();
78347838
let relative_expiry = DEFAULT_RELATIVE_EXPIRY.as_secs() as u32;
78357839

7840+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7841+
78367842
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
78377843
Ok((payment_hash, payment_secret)) => {
78387844
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)

0 commit comments

Comments
 (0)