@@ -861,8 +861,9 @@ impl TryFrom<ParsedMessage<FullInvoiceTlvStream>> for Bolt12Invoice {
861861 None => return Err ( Bolt12ParseError :: InvalidSemantics ( Bolt12SemanticError :: MissingSignature ) ) ,
862862 Some ( signature) => signature,
863863 } ;
864+ let message = TaggedHash :: new ( SIGNATURE_TAG , & bytes) ;
864865 let pubkey = contents. fields ( ) . signing_pubkey ;
865- merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes , pubkey) ?;
866+ merkle:: verify_signature ( & signature, message , pubkey) ?;
866867
867868 Ok ( Bolt12Invoice { bytes, contents, signature } )
868869 }
@@ -1019,11 +1020,9 @@ mod tests {
10191020 assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
10201021 assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
10211022 assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1022- assert ! (
1023- merkle:: verify_signature(
1024- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1025- ) . is_ok( )
1026- ) ;
1023+
1024+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1025+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
10271026
10281027 let digest = Message :: from_slice ( & invoice. signable_hash ( ) ) . unwrap ( ) ;
10291028 let pubkey = recipient_pubkey ( ) . into ( ) ;
@@ -1102,11 +1101,9 @@ mod tests {
11021101 assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
11031102 assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
11041103 assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1105- assert ! (
1106- merkle:: verify_signature(
1107- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1108- ) . is_ok( )
1109- ) ;
1104+
1105+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1106+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
11101107
11111108 assert_eq ! (
11121109 invoice. as_tlv_stream( ) ,
0 commit comments