Skip to content

Commit afdb725

Browse files
committed
Merge #422: Remove bitcoin rand feature from integration testing
92050de Remove bitcoin rand feature from integration testing (sanket1729) Pull request description: Addresses [feedback ](#420 (comment)) #420 's review ACKs for top commit: apoelstra: ACK 92050de RCasatta: ACK 92050de Tree-SHA512: ad3dcc3631eb3ffd6de30d577d8a08756cbb4a2ff1670b21f4902422a2104bbfc8b161583a1ba3dd7368160e2dd51bac1d68c9332fc73a3a72d3c6b3ddcdabb4
2 parents 0ac479f + 92050de commit afdb725

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ serde = { version = "1.0", optional = true}
2525
[dev-dependencies]
2626
bitcoind = {version = "0.26.1", features=["22_0"]}
2727
actual-rand = { package = "rand", version = "0.8.4"}
28-
bitcoin = { version = "0.28", features = ["rand"]}
2928

3029
[[example]]
3130
name = "htlc"

tests/test_desc.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
use std::collections::BTreeMap;
88

9+
use actual_rand as rand;
910
use bitcoin::blockdata::witness::Witness;
1011
use bitcoin::util::psbt::PartiallySignedTransaction as Psbt;
1112
use bitcoin::util::sighash::SighashCache;
@@ -18,9 +19,9 @@ use bitcoind::bitcoincore_rpc::{json, Client, RpcApi};
1819
use miniscript::miniscript::iter;
1920
use miniscript::psbt::{PsbtExt, PsbtInputExt};
2021
use miniscript::{Descriptor, Miniscript, MiniscriptKey, ScriptContext, ToPublicKey};
21-
2222
mod setup;
2323

24+
use rand::RngCore;
2425
use setup::test_util::{self, TestData};
2526
/// Quickly create a BTC amount.
2627
fn 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

Comments
 (0)