Merge #1475: remove commands import in spend module

4668980ff12c1026bf3a1b3b520d1d38db8939cb remove commands import in spend module (edouardparis)

Pull request description:

  This is preparatory work to create a specific liana lib.
  We keep modules separated.

ACKs for top commit:
  edouardparis:
    Self-ACK 4668980ff12c1026bf3a1b3b520d1d38db8939cb

Tree-SHA512: 0c33ab252a2e8b5404893367467ea48dbed8d84b5de0cb15dcc91bf5491b8af0d6bddd4aafe55699e16dcd7cd97b96d462d004b1921a38ae5e438c908d515c03
This commit is contained in:
edouardparis 2024-11-19 14:03:59 +01:00
commit 36b24d4d81
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
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 {