Fix cargo clippy warnings
Disabled warnings for nursery/tmp_plan as it's going to be replaced anyways
This commit is contained in:
@@ -356,26 +356,26 @@ pub(crate) trait DescriptorMeta {
|
||||
fn is_witness(&self) -> bool;
|
||||
fn is_taproot(&self) -> bool;
|
||||
fn get_extended_keys(&self) -> Vec<DescriptorXKey<ExtendedPubKey>>;
|
||||
fn derive_from_hd_keypaths<'s>(
|
||||
fn derive_from_hd_keypaths(
|
||||
&self,
|
||||
hd_keypaths: &HdKeyPaths,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor>;
|
||||
fn derive_from_tap_key_origins<'s>(
|
||||
fn derive_from_tap_key_origins(
|
||||
&self,
|
||||
tap_key_origins: &TapKeyOrigins,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor>;
|
||||
fn derive_from_psbt_key_origins<'s>(
|
||||
fn derive_from_psbt_key_origins(
|
||||
&self,
|
||||
key_origins: BTreeMap<Fingerprint, (&DerivationPath, SinglePubKey)>,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor>;
|
||||
fn derive_from_psbt_input<'s>(
|
||||
fn derive_from_psbt_input(
|
||||
&self,
|
||||
psbt_input: &psbt::Input,
|
||||
utxo: Option<TxOut>,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor>;
|
||||
}
|
||||
|
||||
@@ -410,10 +410,10 @@ impl DescriptorMeta for ExtendedDescriptor {
|
||||
answer
|
||||
}
|
||||
|
||||
fn derive_from_psbt_key_origins<'s>(
|
||||
fn derive_from_psbt_key_origins(
|
||||
&self,
|
||||
key_origins: BTreeMap<Fingerprint, (&DerivationPath, SinglePubKey)>,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor> {
|
||||
// Ensure that deriving `xpub` with `path` yields `expected`
|
||||
let verify_key = |xpub: &DescriptorXKey<ExtendedPubKey>,
|
||||
@@ -497,10 +497,10 @@ impl DescriptorMeta for ExtendedDescriptor {
|
||||
path_found.map(|path| self.at_derivation_index(path))
|
||||
}
|
||||
|
||||
fn derive_from_hd_keypaths<'s>(
|
||||
fn derive_from_hd_keypaths(
|
||||
&self,
|
||||
hd_keypaths: &HdKeyPaths,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor> {
|
||||
// "Convert" an hd_keypaths map to the format required by `derive_from_psbt_key_origins`
|
||||
let key_origins = hd_keypaths
|
||||
@@ -515,10 +515,10 @@ impl DescriptorMeta for ExtendedDescriptor {
|
||||
self.derive_from_psbt_key_origins(key_origins, secp)
|
||||
}
|
||||
|
||||
fn derive_from_tap_key_origins<'s>(
|
||||
fn derive_from_tap_key_origins(
|
||||
&self,
|
||||
tap_key_origins: &TapKeyOrigins,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor> {
|
||||
// "Convert" a tap_key_origins map to the format required by `derive_from_psbt_key_origins`
|
||||
let key_origins = tap_key_origins
|
||||
@@ -528,11 +528,11 @@ impl DescriptorMeta for ExtendedDescriptor {
|
||||
self.derive_from_psbt_key_origins(key_origins, secp)
|
||||
}
|
||||
|
||||
fn derive_from_psbt_input<'s>(
|
||||
fn derive_from_psbt_input(
|
||||
&self,
|
||||
psbt_input: &psbt::Input,
|
||||
utxo: Option<TxOut>,
|
||||
secp: &'s SecpCtx,
|
||||
secp: &SecpCtx,
|
||||
) -> Option<DerivedDescriptor> {
|
||||
if let Some(derived) = self.derive_from_hd_keypaths(&psbt_input.bip32_derivation, secp) {
|
||||
return Some(derived);
|
||||
|
||||
@@ -723,7 +723,7 @@ mod test {
|
||||
fn get_test_utxos() -> Vec<WeightedUtxo> {
|
||||
vec![
|
||||
utxo(100_000, 0, ConfirmationTime::Unconfirmed),
|
||||
utxo(FEE_AMOUNT as u64 - 40, 1, ConfirmationTime::Unconfirmed),
|
||||
utxo(FEE_AMOUNT - 40, 1, ConfirmationTime::Unconfirmed),
|
||||
utxo(200_000, 2, ConfirmationTime::Unconfirmed),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -311,13 +311,12 @@ impl<D> Wallet<D> {
|
||||
.last()
|
||||
.unwrap(),
|
||||
};
|
||||
let info = AddressInfo {
|
||||
AddressInfo {
|
||||
index,
|
||||
address: Address::from_script(&spk, self.network)
|
||||
.expect("descriptor must have address form"),
|
||||
keychain,
|
||||
};
|
||||
info
|
||||
}
|
||||
}
|
||||
|
||||
/// Return whether or not a `script` is part of this wallet (either internal or external)
|
||||
@@ -342,7 +341,7 @@ impl<D> Wallet<D> {
|
||||
.map(|(&(keychain, derivation_index), utxo)| LocalUtxo {
|
||||
outpoint: utxo.outpoint,
|
||||
txout: utxo.txout,
|
||||
keychain: keychain.clone(),
|
||||
keychain,
|
||||
is_spent: false,
|
||||
derivation_index,
|
||||
confirmation_time: utxo.chain_position,
|
||||
@@ -1288,8 +1287,7 @@ impl<D> Wallet<D> {
|
||||
// - If that also fails, it will try it on the internal descriptor, if present
|
||||
let desc = psbt
|
||||
.get_utxo_for(n)
|
||||
.map(|txout| self.get_descriptor_for_txout(&txout))
|
||||
.flatten()
|
||||
.and_then(|txout| self.get_descriptor_for_txout(&txout))
|
||||
.or_else(|| {
|
||||
self.keychain_tracker
|
||||
.txout_index
|
||||
|
||||
@@ -1544,7 +1544,7 @@ fn test_bump_fee_add_input() {
|
||||
}],
|
||||
};
|
||||
wallet
|
||||
.insert_tx(init_tx.clone(), wallet.transactions().last().unwrap().0)
|
||||
.insert_tx(init_tx, wallet.transactions().last().unwrap().0)
|
||||
.unwrap();
|
||||
|
||||
let addr = Address::from_str("2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user