From 51f8f6e2c514ebcc592ef06c598db99e099b2c5a Mon Sep 17 00:00:00 2001 From: Rob N Date: Tue, 16 Apr 2024 20:35:43 -1000 Subject: [PATCH] Remove entropy slice --- crates/bdk/src/wallet/signer.rs | 16 +--------------- crates/bdk/src/wallet/tx_builder.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/crates/bdk/src/wallet/signer.rs b/crates/bdk/src/wallet/signer.rs index 05e0860cab..8bb46dfca0 100644 --- a/crates/bdk/src/wallet/signer.rs +++ b/crates/bdk/src/wallet/signer.rs @@ -471,7 +471,6 @@ impl InputSigner for SignerWrapper { hash, hash_ty, secp, - sign_options.aux_rand, ); } } @@ -507,7 +506,6 @@ impl InputSigner for SignerWrapper { hash, hash_ty, secp, - sign_options.aux_rand, ); } } @@ -577,7 +575,6 @@ fn sign_psbt_schnorr( hash: TapSighash, hash_ty: TapSighashType, secp: &SecpCtx, - aux_rand: Option<[u8; 32]>, ) { let keypair = secp256k1::Keypair::from_seckey_slice(secp, secret_key.as_ref()).unwrap(); let keypair = match leaf_hash { @@ -588,10 +585,7 @@ fn sign_psbt_schnorr( }; let msg = &Message::from(hash); - let sig = match aux_rand { - Some(rand) => secp.sign_schnorr_with_aux_rand(msg, &keypair, &rand), - None => secp.sign_schnorr_no_aux_rand(msg, &keypair), - }; + let sig = secp.sign_schnorr_no_aux_rand(msg, &keypair); secp.verify_schnorr(&sig, msg, &XOnlyPublicKey::from_keypair(&keypair).0) .expect("invalid or corrupted schnorr signature"); @@ -818,13 +812,6 @@ pub struct SignOptions { /// or not. /// Defaults to `true`, i.e., we always grind ECDSA signature to sign with low r. pub allow_grinding: bool, - - /// Add additional entropy to the signature using a random array of bytes. - /// - /// Defaults to `None`. While recommended, additional entropy is not required. - /// - /// See [`BIP 340`](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) for more details. - pub aux_rand: Option<[u8; 32]>, } /// Customize which taproot script-path leaves the signer should sign. @@ -854,7 +841,6 @@ impl Default for SignOptions { tap_leaves_options: TapLeavesOptions::default(), sign_with_tap_internal_key: true, allow_grinding: true, - aux_rand: None, } } } diff --git a/crates/bdk/src/wallet/tx_builder.rs b/crates/bdk/src/wallet/tx_builder.rs index 6391aa70e5..e9a0cab225 100644 --- a/crates/bdk/src/wallet/tx_builder.rs +++ b/crates/bdk/src/wallet/tx_builder.rs @@ -834,8 +834,8 @@ pub enum TxOrdering { /// The custom function to order the inputs of the transaction input_ordering: Box core::cmp::Ordering>, /// The custom function to order the outputs of the transaction - output_ordering: Box core::cmp::Ordering>, - } + output_ordering: Box core::cmp::Ordering>, + }, } impl TxOrdering { @@ -855,7 +855,10 @@ impl TxOrdering { tx.output .sort_unstable_by_key(|txout| (txout.value, txout.script_pubkey.clone())); } - TxOrdering::Custom { input_ordering, output_ordering } => { + TxOrdering::Custom { + input_ordering, + output_ordering, + } => { tx.input.sort_unstable_by(input_ordering); tx.output.sort_unstable_by(output_ordering); }