Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove commands import in spend module #1475

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions liana/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
};
Expand Down
19 changes: 1 addition & 18 deletions liana/src/spend.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{bitcoin::MempoolEntry, descriptors};
use crate::descriptors;

use std::{
collections::{BTreeMap, HashMap},
Expand Down Expand Up @@ -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 {
Expand Down
Loading