@@ -1184,8 +1184,9 @@ impl TryFrom<ParsedMessage<FullInvoiceTlvStream>> for Bolt12Invoice {
11841184 None => return Err ( Bolt12ParseError :: InvalidSemantics ( Bolt12SemanticError :: MissingSignature ) ) ,
11851185 Some ( signature) => signature,
11861186 } ;
1187+ let message = TaggedHash :: new ( SIGNATURE_TAG , & bytes) ;
11871188 let pubkey = contents. fields ( ) . signing_pubkey ;
1188- merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes , pubkey) ?;
1189+ merkle:: verify_signature ( & signature, message , pubkey) ?;
11891190
11901191 Ok ( Bolt12Invoice { bytes, contents, signature } )
11911192 }
@@ -1288,7 +1289,7 @@ mod tests {
12881289 use crate :: ln:: inbound_payment:: ExpandedKey ;
12891290 use crate :: ln:: msgs:: DecodeError ;
12901291 use crate :: offers:: invoice_request:: InvoiceRequestTlvStreamRef ;
1291- use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , self } ;
1292+ use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , TaggedHash , self } ;
12921293 use crate :: offers:: offer:: { Amount , OfferBuilder , OfferTlvStreamRef , Quantity } ;
12931294 use crate :: offers:: parse:: { Bolt12ParseError , Bolt12SemanticError } ;
12941295 use crate :: offers:: payer:: PayerTlvStreamRef ;
@@ -1400,11 +1401,9 @@ mod tests {
14001401 assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
14011402 assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
14021403 assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1403- assert ! (
1404- merkle:: verify_signature(
1405- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1406- ) . is_ok( )
1407- ) ;
1404+
1405+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1406+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
14081407
14091408 let digest = Message :: from_slice ( & invoice. signable_hash ( ) ) . unwrap ( ) ;
14101409 let pubkey = recipient_pubkey ( ) . into ( ) ;
@@ -1499,11 +1498,9 @@ mod tests {
14991498 assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
15001499 assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
15011500 assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1502- assert ! (
1503- merkle:: verify_signature(
1504- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1505- ) . is_ok( )
1506- ) ;
1501+
1502+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1503+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
15071504
15081505 assert_eq ! (
15091506 invoice. as_tlv_stream( ) ,
0 commit comments