Skip to content

Commit 59e9707

Browse files
committed
f Assert unique manual payment hashes
Document the pending-store invariant that a manual BOLT11 hash maps to at most one pending payment id. Co-Authored-By: HAL 9000
1 parent 64802f3 commit 59e9707

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/payment/pending_payment_store.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ where
246246
) -> Option<PendingPaymentDetails> {
247247
let index = self.manual_bolt11_payment_hash_index.lock().expect("lock");
248248
let ids = index.get(payment_hash)?;
249+
debug_assert!(
250+
ids.len() <= 1,
251+
"manual BOLT11 payment hash maps to multiple pending payment IDs"
252+
);
249253
ids.iter().find_map(|id| self.inner.get(id))
250254
}
251255

0 commit comments

Comments
 (0)