Don't send InvoiceError on failed authentication

When an invoice or invoice request cannot be authenticated from an
OffersContext, simply do not respond instead of sending an InvoiceError
message. According to BOLT4, messages sent over a blinded path not
intended for its use MUST be ignored.
This commit is contained in:
Jeffrey Czyz 2024-07-03 10:50:02 -05:00
parent c2a120eeef
commit 559daeb2ae
No known key found for this signature in database
GPG key ID: 912EF12EA67705F5

View file

@ -10719,10 +10719,7 @@ where
}, },
None => match invoice_request.verify_using_metadata(expanded_key, secp_ctx) { None => match invoice_request.verify_using_metadata(expanded_key, secp_ctx) {
Ok(invoice_request) => invoice_request, Ok(invoice_request) => invoice_request,
Err(()) => { Err(()) => return ResponseInstruction::NoResponse,
let error = Bolt12SemanticError::InvalidMetadata;
return responder.respond(OffersMessage::InvoiceError(error.into()));
},
}, },
}; };
@ -10833,7 +10830,7 @@ where
}) })
} }
}, },
Err(()) => Err(InvoiceError::from_string("Unrecognized invoice".to_owned())), Err(()) => return ResponseInstruction::NoResponse,
}; };
match result { match result {