File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use bitcoin::hashes::sha256d::Hash as Sha256dHash;
25
25
use bitcoin:: hash_types:: WPubkeyHash ;
26
26
27
27
use bitcoin:: secp256k1:: key:: { SecretKey , PublicKey } ;
28
- use bitcoin:: secp256k1:: { Message , Secp256k1 , Signature , Signing } ;
28
+ use bitcoin:: secp256k1:: { Secp256k1 , Signature , Signing } ;
29
29
use bitcoin:: secp256k1:: recovery:: RecoverableSignature ;
30
30
use bitcoin:: secp256k1;
31
31
@@ -1056,12 +1056,7 @@ impl KeysInterface for KeysManager {
1056
1056
}
1057
1057
1058
1058
fn sign_invoice ( & self , invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > {
1059
- let secp_ctx = Secp256k1 :: new ( ) ;
1060
- let mut raw_hash: [ u8 ; 32 ] = Default :: default ( ) ;
1061
- raw_hash. copy_from_slice ( & Sha256 :: hash ( & invoice_preimage) [ ..] ) ;
1062
- let msg_hash = Message :: from_slice ( & raw_hash[ ..] )
1063
- . expect ( "Hash is 32 bytes long, same as MESSAGE_SIZE" ) ;
1064
- Ok ( secp_ctx. sign_recoverable ( & msg_hash, & self . get_node_secret ( ) ) )
1059
+ Ok ( self . secp_ctx . sign_recoverable ( & hash_to_message ! ( & Sha256 :: hash( & invoice_preimage) ) , & self . get_node_secret ( ) ) )
1065
1060
}
1066
1061
}
1067
1062
You can’t perform that action at this time.
0 commit comments