66
77use std:: collections:: BTreeMap ;
88
9+ use actual_rand as rand;
910use bitcoin:: blockdata:: witness:: Witness ;
1011use bitcoin:: util:: psbt:: PartiallySignedTransaction as Psbt ;
1112use bitcoin:: util:: sighash:: SighashCache ;
@@ -18,9 +19,9 @@ use bitcoind::bitcoincore_rpc::{json, Client, RpcApi};
1819use miniscript:: miniscript:: iter;
1920use miniscript:: psbt:: { PsbtExt , PsbtInputExt } ;
2021use miniscript:: { Descriptor , Miniscript , MiniscriptKey , ScriptContext , ToPublicKey } ;
21-
2222mod setup;
2323
24+ use rand:: RngCore ;
2425use setup:: test_util:: { self , TestData } ;
2526/// Quickly create a BTC amount.
2627fn btc < F : Into < f64 > > ( btc : F ) -> Amount {
@@ -145,7 +146,10 @@ pub fn test_desc_satisfy(cl: &Client, testdata: &TestData, desc: &str) -> Witnes
145146 . taproot_key_spend_signature_hash ( 0 , & prevouts, hash_ty)
146147 . unwrap ( ) ;
147148 let msg = secp256k1:: Message :: from_slice ( & sighash_msg[ ..] ) . unwrap ( ) ;
148- let schnorr_sig = secp. sign_schnorr ( & msg, & internal_keypair) ;
149+ let mut aux_rand = [ 0u8 ; 32 ] ;
150+ rand:: thread_rng ( ) . fill_bytes ( & mut aux_rand) ;
151+ let schnorr_sig =
152+ secp. sign_schnorr_with_aux_rand ( & msg, & internal_keypair, & aux_rand) ;
149153 psbt. inputs [ 0 ] . tap_key_sig = Some ( SchnorrSig {
150154 sig : schnorr_sig,
151155 hash_ty : hash_ty,
@@ -177,7 +181,9 @@ pub fn test_desc_satisfy(cl: &Client, testdata: &TestData, desc: &str) -> Witnes
177181 . taproot_script_spend_signature_hash ( 0 , & prevouts, leaf_hash, hash_ty)
178182 . unwrap ( ) ;
179183 let msg = secp256k1:: Message :: from_slice ( & sighash_msg[ ..] ) . unwrap ( ) ;
180- let sig = secp. sign_schnorr ( & msg, & keypair) ;
184+ let mut aux_rand = [ 0u8 ; 32 ] ;
185+ rand:: thread_rng ( ) . fill_bytes ( & mut aux_rand) ;
186+ let sig = secp. sign_schnorr_with_aux_rand ( & msg, & keypair, & aux_rand) ;
181187 // FIXME: uncomment when == is supported for secp256k1::KeyPair. (next major release)
182188 // let x_only_pk = pks[xonly_keypairs.iter().position(|&x| x == keypair).unwrap()];
183189 // Just recalc public key
0 commit comments