Skip to content

Commit 8502490

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 8502490

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning/src/ln/channelmanager.rs

+4
Original file line numberDiff line numberDiff line change
@@ -7772,6 +7772,8 @@ where
77727772
let invoice_request = builder.build_and_sign()?;
77737773
let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
77747774

7775+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7776+
77757777
let expiration = StaleExpiration::TimerTicks(1);
77767778
self.pending_outbound_payments
77777779
.add_new_awaiting_invoice(
@@ -7833,6 +7835,8 @@ where
78337835
let amount_msats = refund.amount_msats();
78347836
let relative_expiry = DEFAULT_RELATIVE_EXPIRY.as_secs() as u32;
78357837

7838+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7839+
78367840
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
78377841
Ok((payment_hash, payment_secret)) => {
78387842
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)

0 commit comments

Comments
 (0)