diff --git a/liana/src/commands/mod.rs b/liana/src/commands/mod.rs index 70f674225..bfdce741f 100644 --- a/liana/src/commands/mod.rs +++ b/liana/src/commands/mod.rs @@ -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 }; diff --git a/liana/src/spend.rs b/liana/src/spend.rs index 5a907ae5a..2db855aca 100644 --- a/liana/src/spend.rs +++ b/liana/src/spend.rs @@ -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 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 {