}
} else {
save_transaction_details_and_utxos(
- &txid,
+ txid,
db,
timestamp,
height,
// remove any tx details in db but not in history_txs_id
for txid in txs_details_in_db.keys() {
if !history_txs_id.contains(txid) {
- batch.del_tx(&txid, false)?;
+ batch.del_tx(txid, false)?;
}
}
// removes conflicting UTXO if any (generated from same inputs, like for example RBF)
if let Some(outpoint) = utxo_deps.get(&input.previous_output) {
- updates.del_utxo(&outpoint)?;
+ updates.del_utxo(outpoint)?;
}
}
.map(|b| -> Result<_, Error> {
let mut txdetails: TransactionDetails = serde_json::from_slice(&b)?;
if include_raw {
- txdetails.transaction = self.get_raw_tx(&txid)?;
+ txdetails.transaction = self.get_raw_tx(txid)?;
}
Ok(txdetails)
Ok(self.map.get(&key).map(|b| {
let mut txdetails: TransactionDetails = b.downcast_ref().cloned().unwrap();
if include_raw {
- txdetails.transaction = self.get_raw_tx(&txid).unwrap();
+ txdetails.transaction = self.get_raw_tx(txid).unwrap();
}
txdetails
let (pk, _, networks) = if self.0.is_witness() {
let desciptor_key: DescriptorKey<miniscript::Segwitv0> =
pk.clone().into_descriptor_key()?;
- desciptor_key.extract(&secp)?
+ desciptor_key.extract(secp)?
} else {
let desciptor_key: DescriptorKey<miniscript::Legacy> =
pk.clone().into_descriptor_key()?;
- desciptor_key.extract(&secp)?
+ desciptor_key.extract(secp)?
};
if networks.contains(&network) {
items.push(inner_index);
let conditions_set = other_conditions
.values()
- .fold(HashSet::new(), |set, i| set.union(&i).cloned().collect());
+ .fold(HashSet::new(), |set, i| set.union(i).cloned().collect());
conditions.insert(inner_index, conditions_set);
}
}
) -> (DescriptorKey<Ctx>, DescriptorKey<Ctx>, Fingerprint) {
let path = bip32::DerivationPath::from_str(path).unwrap();
let tprv = bip32::ExtendedPrivKey::from_str(tprv).unwrap();
- let tpub = bip32::ExtendedPubKey::from_private(&secp, &tprv);
- let fingerprint = tprv.fingerprint(&secp);
+ let tpub = bip32::ExtendedPubKey::from_private(secp, &tprv);
+ let fingerprint = tprv.fingerprint(secp);
let prvkey = (tprv, path.clone()).into_descriptor_key().unwrap();
let pubkey = (tpub, path).into_descriptor_key().unwrap();
}
if let Some(txout) = &psbt_input.witness_utxo {
- return &txout;
+ return txout;
}
unreachable!("Foreign UTXOs will always have one of these set")
/// [`TxBuilder`]: crate::TxBuilder
pub fn build_tx(&self) -> TxBuilder<'_, B, D, DefaultCoinSelectionAlgorithm, CreateTx> {
TxBuilder {
- wallet: &self,
+ wallet: self,
params: TxParams::default(),
coin_selection: DefaultCoinSelectionAlgorithm::default(),
phantom: core::marker::PhantomData,
};
Ok(TxBuilder {
- wallet: &self,
+ wallet: self,
params,
coin_selection: DefaultCoinSelectionAlgorithm::default(),
phantom: core::marker::PhantomData,
match desc.satisfy(
&mut tmp_input,
(
- PsbtInputSatisfier::new(&psbt, n),
+ PsbtInputSatisfier::new(psbt, n),
After::new(current_height, false),
Older::new(current_height, create_height, false),
),
.bip32_derivation
.iter()
.filter_map(|(pk, &(fingerprint, ref path))| {
- if self.matches(&(fingerprint, path.clone()), &secp).is_some() {
+ if self.matches(&(fingerprint, path.clone()), secp).is_some() {
Some((pk, path))
} else {
None
&full_path.into_iter().cloned().collect::<Vec<ChildNumber>>()
[origin_path.len()..],
);
- self.xkey.derive_priv(&secp, &deriv_path).unwrap()
+ self.xkey.derive_priv(secp, &deriv_path).unwrap()
}
- None => self.xkey.derive_priv(&secp, &full_path).unwrap(),
+ None => self.xkey.derive_priv(secp, &full_path).unwrap(),
};
- if &derived_key.private_key.public_key(&secp) != public_key {
+ if &derived_key.private_key.public_key(secp) != public_key {
Err(SignerError::InvalidKey)
} else {
derived_key.private_key.sign(psbt, Some(input_index), secp)
}
fn id(&self, secp: &SecpCtx) -> SignerId {
- SignerId::from(self.root_fingerprint(&secp))
+ SignerId::from(self.root_fingerprint(secp))
}
fn descriptor_secret_key(&self) -> Option<DescriptorSecretKey> {
return Ok(());
}
- let pubkey = self.public_key(&secp);
+ let pubkey = self.public_key(secp);
if psbt.inputs[input_index].partial_sigs.contains_key(&pubkey) {
return Ok(());
}
.map(Script::is_v0_p2wpkh)
.unwrap_or(false)
{
- p2wpkh_script_code(&psbt_input.redeem_script.as_ref().unwrap())
+ p2wpkh_script_code(psbt_input.redeem_script.as_ref().unwrap())
} else {
return Err(SignerError::MissingWitnessScript);
}