remove commands import in spend module

This commit is contained in:
edouardparis 2024-11-19 13:30:43 +01:00
parent 1454c11f41
commit 4668980ff1
2 changed files with 29 additions and 20 deletions

View File

@ -504,7 +504,20 @@ impl DaemonControl {
// any ancestor info.
Some((
c,
self.bitcoin.mempool_entry(&op.txid).map(AncestorInfo::from),
self.bitcoin
.mempool_entry(&op.txid)
.map(|info| AncestorInfo {
vsize: info
.ancestor_vsize
.try_into()
.expect("vsize must fit in u32"),
fee: info
.fees
.ancestor
.to_sat()
.try_into()
.expect("fee in sat should fit in u32"),
}),
))
} else {
None
@ -538,7 +551,20 @@ impl DaemonControl {
// We include any non-change coins here as they have been selected by the caller.
// If the unconfirmed coin's transaction is no longer in the mempool, keep the
// coin as a candidate but without any ancestor info (same as confirmed candidate).
self.bitcoin.mempool_entry(&op.txid).map(AncestorInfo::from)
self.bitcoin
.mempool_entry(&op.txid)
.map(|info| AncestorInfo {
vsize: info
.ancestor_vsize
.try_into()
.expect("vsize must fit in u32"),
fee: info
.fees
.ancestor
.to_sat()
.try_into()
.expect("fee in sat should fit in u32"),
})
} else {
None
};

View File

@ -1,4 +1,4 @@
use crate::{bitcoin::MempoolEntry, descriptors};
use crate::descriptors;
use std::{
collections::{BTreeMap, HashMap},
@ -171,23 +171,6 @@ pub struct AncestorInfo {
pub fee: u32,
}
impl From<MempoolEntry> for AncestorInfo {
fn from(entry: MempoolEntry) -> Self {
Self {
vsize: entry
.ancestor_vsize
.try_into()
.expect("vsize must fit in a u32"),
fee: entry
.fees
.ancestor
.to_sat()
.try_into()
.expect("fee in sats should fit in a u32"),
}
}
}
/// A candidate for coin selection when creating a transaction.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CandidateCoin {