Skip to content

Commit ccd8971

Browse files
committed
f Batch-prune expired pending payments
Use the batch removal path for both manual BOLT11 pruning callsites introduced by the manual-invoice tracking change. Co-Authored-By: HAL 9000
1 parent da39b52 commit ccd8971

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

src/event.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,9 @@ where
624624
.map(|payment| payment.details.id)
625625
.collect::<Vec<_>>();
626626

627-
for payment_id in expired_payment_ids {
628-
if let Err(e) = self.pending_payment_store.remove(&payment_id).await {
629-
log_error!(
630-
self.logger,
631-
"Failed to remove expired pending payment with ID {}: {}",
632-
payment_id,
633-
e
634-
);
635-
return Err(ReplayEvent());
636-
}
627+
if let Err(e) = self.pending_payment_store.remove_batch(&expired_payment_ids).await {
628+
log_error!(self.logger, "Failed to remove expired pending payments: {}", e);
629+
return Err(ReplayEvent());
637630
}
638631

639632
Ok(())

src/payment/bolt11.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ impl Bolt11Payment {
116116
.map(|payment| payment.details.id)
117117
.collect::<Vec<_>>();
118118

119-
for payment_id in expired_payment_ids {
120-
self.runtime.block_on(self.pending_payment_store.remove(&payment_id))?;
121-
}
122-
123-
Ok(())
119+
self.runtime.block_on(self.pending_payment_store.remove_batch(&expired_payment_ids))
124120
}
125121

126122
fn pending_manual_claim_invoice(

0 commit comments

Comments
 (0)