@@ -879,8 +879,9 @@ impl TryFrom<ParsedMessage<FullInvoiceTlvStream>> for Bolt12Invoice {
879
879
None => return Err ( Bolt12ParseError :: InvalidSemantics ( Bolt12SemanticError :: MissingSignature ) ) ,
880
880
Some ( signature) => signature,
881
881
} ;
882
+ let message = TaggedHash :: new ( SIGNATURE_TAG , & bytes) ;
882
883
let pubkey = contents. fields ( ) . signing_pubkey ;
883
- merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes , pubkey) ?;
884
+ merkle:: verify_signature ( & signature, message , pubkey) ?;
884
885
885
886
Ok ( Bolt12Invoice { bytes, contents, signature } )
886
887
}
@@ -982,7 +983,7 @@ mod tests {
982
983
use crate :: ln:: inbound_payment:: ExpandedKey ;
983
984
use crate :: ln:: msgs:: DecodeError ;
984
985
use crate :: offers:: invoice_request:: InvoiceRequestTlvStreamRef ;
985
- use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , self } ;
986
+ use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , TaggedHash , self } ;
986
987
use crate :: offers:: offer:: { OfferBuilder , OfferTlvStreamRef , Quantity } ;
987
988
use crate :: offers:: parse:: { Bolt12ParseError , Bolt12SemanticError } ;
988
989
use crate :: offers:: payer:: PayerTlvStreamRef ;
@@ -1037,11 +1038,9 @@ mod tests {
1037
1038
assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
1038
1039
assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1039
1040
assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1040
- assert ! (
1041
- merkle:: verify_signature(
1042
- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1043
- ) . is_ok( )
1044
- ) ;
1041
+
1042
+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1043
+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
1045
1044
1046
1045
let digest = Message :: from_slice ( & invoice. signable_hash ( ) ) . unwrap ( ) ;
1047
1046
let pubkey = recipient_pubkey ( ) . into ( ) ;
@@ -1120,11 +1119,9 @@ mod tests {
1120
1119
assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
1121
1120
assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1122
1121
assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1123
- assert ! (
1124
- merkle:: verify_signature(
1125
- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1126
- ) . is_ok( )
1127
- ) ;
1122
+
1123
+ let message = TaggedHash :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1124
+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
1128
1125
1129
1126
assert_eq ! (
1130
1127
invoice. as_tlv_stream( ) ,
0 commit comments