@@ -868,8 +868,9 @@ impl TryFrom<ParsedMessage<FullInvoiceTlvStream>> for Invoice {
868
868
None => return Err ( ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
869
869
Some ( signature) => signature,
870
870
} ;
871
+ let message = TaggedBytes :: new ( SIGNATURE_TAG , & bytes) ;
871
872
let pubkey = contents. fields ( ) . signing_pubkey ;
872
- merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes , pubkey) ?;
873
+ merkle:: verify_signature ( & signature, message , pubkey) ?;
873
874
874
875
Ok ( Invoice { bytes, contents, signature } )
875
876
}
@@ -971,7 +972,7 @@ mod tests {
971
972
use crate :: ln:: inbound_payment:: ExpandedKey ;
972
973
use crate :: ln:: msgs:: DecodeError ;
973
974
use crate :: offers:: invoice_request:: InvoiceRequestTlvStreamRef ;
974
- use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , self } ;
975
+ use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , TaggedBytes , self } ;
975
976
use crate :: offers:: offer:: { OfferBuilder , OfferTlvStreamRef , Quantity } ;
976
977
use crate :: offers:: parse:: { ParseError , SemanticError } ;
977
978
use crate :: offers:: payer:: PayerTlvStreamRef ;
@@ -1026,11 +1027,9 @@ mod tests {
1026
1027
assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
1027
1028
assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1028
1029
assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1029
- assert ! (
1030
- merkle:: verify_signature(
1031
- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1032
- ) . is_ok( )
1033
- ) ;
1030
+
1031
+ let message = TaggedBytes :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1032
+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
1034
1033
1035
1034
let digest = Message :: from_slice ( & invoice. signable_hash ( ) ) . unwrap ( ) ;
1036
1035
let pubkey = recipient_pubkey ( ) . into ( ) ;
@@ -1109,11 +1108,9 @@ mod tests {
1109
1108
assert_eq ! ( invoice. fallbacks( ) , vec![ ] ) ;
1110
1109
assert_eq ! ( invoice. features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1111
1110
assert_eq ! ( invoice. signing_pubkey( ) , recipient_pubkey( ) ) ;
1112
- assert ! (
1113
- merkle:: verify_signature(
1114
- & invoice. signature, SIGNATURE_TAG , & invoice. bytes, recipient_pubkey( )
1115
- ) . is_ok( )
1116
- ) ;
1111
+
1112
+ let message = TaggedBytes :: new ( SIGNATURE_TAG , & invoice. bytes ) ;
1113
+ assert ! ( merkle:: verify_signature( & invoice. signature, message, recipient_pubkey( ) ) . is_ok( ) ) ;
1117
1114
1118
1115
assert_eq ! (
1119
1116
invoice. as_tlv_stream( ) ,
0 commit comments