Skip to content

Commit e0fcca0

Browse files
committed
WIP: Authenticate invoices
1 parent 902c56a commit e0fcca0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/ln/channelmanager.rs

+9
Original file line numberDiff line numberDiff line change
@@ -10366,8 +10366,17 @@ where
1036610366
}
1036710367
},
1036810368
OffersMessage::Invoice(invoice) => {
10369+
let expected_payment_id = match context {
10370+
OffersContext::OutboundPayment { payment_id } => payment_id,
10371+
_ => return ResponseInstruction::NoResponse,
10372+
};
10373+
1036910374
let result = match invoice.verify(expanded_key, secp_ctx) {
1037010375
Ok(payment_id) => {
10376+
if payment_id != expected_payment_id {
10377+
return ResponseInstruction::NoResponse;
10378+
}
10379+
1037110380
let features = self.bolt12_invoice_features();
1037210381
if invoice.invoice_features().requires_unknown_bits_from(&features) {
1037310382
Err(InvoiceError::from(Bolt12SemanticError::UnknownRequiredFeatures))

0 commit comments

Comments
 (0)