Skip to content

Commit 028d919

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 98340dc commit 028d919

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
@@ -7755,6 +7755,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
77557755
.absolute_expiry(absolute_expiry)
77567756
.path(path);
77577757

7758+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7759+
77587760
let expiration = StaleExpiration::AbsoluteTimeout(absolute_expiry);
77597761
$self.pending_outbound_payments
77607762
.add_new_awaiting_invoice(
@@ -7870,6 +7872,8 @@ where
78707872
let invoice_request = builder.build_and_sign()?;
78717873
let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
78727874

7875+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7876+
78737877
let expiration = StaleExpiration::TimerTicks(1);
78747878
self.pending_outbound_payments
78757879
.add_new_awaiting_invoice(
@@ -7937,6 +7941,8 @@ where
79377941
return Err(Bolt12SemanticError::UnsupportedChain);
79387942
}
79397943

7944+
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7945+
79407946
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
79417947
Ok((payment_hash, payment_secret)) => {
79427948
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)

0 commit comments

Comments
 (0)