2025-06-15 automated rustfmt nightly
This commit is contained in:
parent
052514e6ff
commit
81dbfae0a8
|
@ -517,11 +517,7 @@ impl TransactionExtPriv for Transaction {
|
||||||
1
|
1
|
||||||
} else if witness_program.is_p2wsh() {
|
} else if witness_program.is_p2wsh() {
|
||||||
// Treat the last item of the witness as the witnessScript
|
// Treat the last item of the witness as the witnessScript
|
||||||
witness
|
witness.last().map(Script::from_bytes).map(|s| s.count_sigops()).unwrap_or(0)
|
||||||
.last()
|
|
||||||
.map(Script::from_bytes)
|
|
||||||
.map(|s| s.count_sigops())
|
|
||||||
.unwrap_or(0)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -891,11 +891,11 @@ impl GetKey for $map<PublicKey, PrivateKey> {
|
||||||
KeyRequest::XOnlyPubkey(xonly) => {
|
KeyRequest::XOnlyPubkey(xonly) => {
|
||||||
let pubkey_even = xonly.public_key(secp256k1::Parity::Even);
|
let pubkey_even = xonly.public_key(secp256k1::Parity::Even);
|
||||||
let key = self.get(&pubkey_even).cloned();
|
let key = self.get(&pubkey_even).cloned();
|
||||||
|
|
||||||
if key.is_some() {
|
if key.is_some() {
|
||||||
return Ok(key);
|
return Ok(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
let pubkey_odd = xonly.public_key(secp256k1::Parity::Odd);
|
let pubkey_odd = xonly.public_key(secp256k1::Parity::Odd);
|
||||||
if let Some(priv_key) = self.get(&pubkey_odd).copied() {
|
if let Some(priv_key) = self.get(&pubkey_odd).copied() {
|
||||||
let negated_priv_key = priv_key.negate();
|
let negated_priv_key = priv_key.negate();
|
||||||
|
@ -928,18 +928,18 @@ impl GetKey for $map<XOnlyPublicKey, PrivateKey> {
|
||||||
KeyRequest::XOnlyPubkey(xonly) => Ok(self.get(xonly).cloned()),
|
KeyRequest::XOnlyPubkey(xonly) => Ok(self.get(xonly).cloned()),
|
||||||
KeyRequest::Pubkey(pk) => {
|
KeyRequest::Pubkey(pk) => {
|
||||||
let (xonly, parity) = pk.inner.x_only_public_key();
|
let (xonly, parity) = pk.inner.x_only_public_key();
|
||||||
|
|
||||||
if let Some(mut priv_key) = self.get(&XOnlyPublicKey::from(xonly)).cloned() {
|
if let Some(mut priv_key) = self.get(&XOnlyPublicKey::from(xonly)).cloned() {
|
||||||
let computed_pk = priv_key.public_key(&secp);
|
let computed_pk = priv_key.public_key(&secp);
|
||||||
let (_, computed_parity) = computed_pk.inner.x_only_public_key();
|
let (_, computed_parity) = computed_pk.inner.x_only_public_key();
|
||||||
|
|
||||||
if computed_parity != parity {
|
if computed_parity != parity {
|
||||||
priv_key = priv_key.negate();
|
priv_key = priv_key.negate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(Some(priv_key));
|
return Ok(Some(priv_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
},
|
},
|
||||||
KeyRequest::Bip32(_) => Err(GetKeyError::NotSupported),
|
KeyRequest::Bip32(_) => Err(GetKeyError::NotSupported),
|
||||||
|
|
|
@ -779,7 +779,9 @@ impl TapTree {
|
||||||
|
|
||||||
/// Returns [`TapTreeIter<'_>`] iterator for a Taproot script tree, operating in DFS order over
|
/// Returns [`TapTreeIter<'_>`] iterator for a Taproot script tree, operating in DFS order over
|
||||||
/// tree [`ScriptLeaf`]s.
|
/// tree [`ScriptLeaf`]s.
|
||||||
pub fn script_leaves(&self) -> ScriptLeaves<'_> { ScriptLeaves { leaf_iter: self.0.leaf_nodes() } }
|
pub fn script_leaves(&self) -> ScriptLeaves<'_> {
|
||||||
|
ScriptLeaves { leaf_iter: self.0.leaf_nodes() }
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the root [`TapNodeHash`] of this tree.
|
/// Returns the root [`TapNodeHash`] of this tree.
|
||||||
pub fn root_hash(&self) -> TapNodeHash { self.0.hash }
|
pub fn root_hash(&self) -> TapNodeHash { self.0.hash }
|
||||||
|
|
|
@ -10,7 +10,6 @@ use core::ops;
|
||||||
|
|
||||||
#[cfg(feature = "arbitrary")]
|
#[cfg(feature = "arbitrary")]
|
||||||
use arbitrary::{Arbitrary, Unstructured};
|
use arbitrary::{Arbitrary, Unstructured};
|
||||||
|
|
||||||
use NumOpResult as R;
|
use NumOpResult as R;
|
||||||
|
|
||||||
use crate::{Amount, MathOp, NumOpError as E, NumOpResult, Weight};
|
use crate::{Amount, MathOp, NumOpError as E, NumOpResult, Weight};
|
||||||
|
|
Loading…
Reference in New Issue