Skip to content

Commit 8233689

Browse files
committed
Authenticate payment_id from OffersContext
Before abandoning a payment when receiving an InvoiceError, verify that the PaymentId included in the OffersContext with the included HMAC. This prevents a malicious actor sending an InvoiceError with a known payment id from abandoning our payment.
1 parent bf7e5ac commit 8233689

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10723,8 +10723,10 @@ where
1072310723

1072410724
let abandon_if_payment = |context| {
1072510725
match context {
10726-
Some(OffersContext::OutboundPayment { payment_id, .. }) => {
10727-
self.abandon_payment(payment_id)
10726+
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac }) => {
10727+
if signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
10728+
self.abandon_payment(payment_id);
10729+
}
1072810730
},
1072910731
_ => {},
1073010732
}

0 commit comments

Comments
 (0)