mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
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.
This commit is contained in:
parent
98340dc253
commit
b29033659f
1 changed files with 6 additions and 0 deletions
|
@ -7755,6 +7755,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
|
||||||
.absolute_expiry(absolute_expiry)
|
.absolute_expiry(absolute_expiry)
|
||||||
.path(path);
|
.path(path);
|
||||||
|
|
||||||
|
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop($self);
|
||||||
|
|
||||||
let expiration = StaleExpiration::AbsoluteTimeout(absolute_expiry);
|
let expiration = StaleExpiration::AbsoluteTimeout(absolute_expiry);
|
||||||
$self.pending_outbound_payments
|
$self.pending_outbound_payments
|
||||||
.add_new_awaiting_invoice(
|
.add_new_awaiting_invoice(
|
||||||
|
@ -7870,6 +7872,8 @@ where
|
||||||
let invoice_request = builder.build_and_sign()?;
|
let invoice_request = builder.build_and_sign()?;
|
||||||
let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
|
let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
|
||||||
|
|
||||||
|
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
|
||||||
|
|
||||||
let expiration = StaleExpiration::TimerTicks(1);
|
let expiration = StaleExpiration::TimerTicks(1);
|
||||||
self.pending_outbound_payments
|
self.pending_outbound_payments
|
||||||
.add_new_awaiting_invoice(
|
.add_new_awaiting_invoice(
|
||||||
|
@ -7937,6 +7941,8 @@ where
|
||||||
return Err(Bolt12SemanticError::UnsupportedChain);
|
return Err(Bolt12SemanticError::UnsupportedChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
|
||||||
|
|
||||||
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
|
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
|
||||||
Ok((payment_hash, payment_secret)) => {
|
Ok((payment_hash, payment_secret)) => {
|
||||||
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)
|
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)
|
||||||
|
|
Loading…
Add table
Reference in a new issue