chore: organize some imports

This commit is contained in:
vmammal 2023-11-16 18:45:21 -05:00
parent 89608ddd0f
commit 0d64beb040
No known key found for this signature in database
4 changed files with 16 additions and 19 deletions

View File

@ -33,8 +33,8 @@ use bdk_chain::{
use bitcoin::secp256k1::{All, Secp256k1}; use bitcoin::secp256k1::{All, Secp256k1};
use bitcoin::sighash::{EcdsaSighashType, TapSighashType}; use bitcoin::sighash::{EcdsaSighashType, TapSighashType};
use bitcoin::{ use bitcoin::{
absolute, Address, Block, FeeRate, Network, OutPoint, Script, ScriptBuf, Sequence, Transaction, TxOut, absolute, Address, Block, FeeRate, Network, OutPoint, Script, ScriptBuf, Sequence, Transaction,
Txid, Weight, Witness, TxOut, Txid, Weight, Witness,
}; };
use bitcoin::{consensus::encode::serialize, BlockHash}; use bitcoin::{consensus::encode::serialize, BlockHash};
use bitcoin::{constants::genesis_block, psbt}; use bitcoin::{constants::genesis_block, psbt};

View File

@ -40,23 +40,21 @@
//! # Ok::<(), anyhow::Error>(()) //! # Ok::<(), anyhow::Error>(())
//! ``` //! ```
use crate::collections::BTreeMap;
use crate::collections::HashSet;
use alloc::{boxed::Box, rc::Rc, string::String, vec::Vec}; use alloc::{boxed::Box, rc::Rc, string::String, vec::Vec};
use bdk_chain::PersistBackend;
use core::cell::RefCell; use core::cell::RefCell;
use core::fmt; use core::fmt;
use core::marker::PhantomData; use core::marker::PhantomData;
use bdk_chain::PersistBackend;
use bitcoin::psbt::{self, PartiallySignedTransaction as Psbt}; use bitcoin::psbt::{self, PartiallySignedTransaction as Psbt};
use bitcoin::{absolute, script::PushBytes, OutPoint, ScriptBuf, Sequence, Transaction, Txid}; use bitcoin::script::PushBytes;
use bitcoin::{absolute, FeeRate, OutPoint, ScriptBuf, Sequence, Transaction, Txid};
use super::coin_selection::{CoinSelectionAlgorithm, DefaultCoinSelectionAlgorithm}; use super::coin_selection::{CoinSelectionAlgorithm, DefaultCoinSelectionAlgorithm};
use super::ChangeSet; use super::{ChangeSet, CreateTxError, Wallet};
use crate::types::{KeychainKind, LocalOutput, WeightedUtxo}; use crate::collections::{BTreeMap, HashSet};
use crate::wallet::CreateTxError; use crate::{KeychainKind, LocalOutput, Utxo, WeightedUtxo};
use crate::{Utxo, Wallet};
use bitcoin::FeeRate;
/// Context in which the [`TxBuilder`] is valid /// Context in which the [`TxBuilder`] is valid
pub trait TxBuilderContext: core::fmt::Debug + Default + Clone {} pub trait TxBuilderContext: core::fmt::Debug + Default + Clone {}

View File

@ -162,7 +162,7 @@ pub fn get_test_tr_dup_keys() -> &'static str {
/// **Note** this 'quick and dirty' conversion should only be used when the input /// **Note** this 'quick and dirty' conversion should only be used when the input
/// parameter has units of `satoshis/vbyte` **AND** is not expected to overflow, /// parameter has units of `satoshis/vbyte` **AND** is not expected to overflow,
/// or else the resulting value will be inaccurate. /// or else the resulting value will be inaccurate.
fn feerate_unchecked(sat_vb: f64) -> FeeRate { pub fn feerate_unchecked(sat_vb: f64) -> FeeRate {
// 1 sat_vb / 4wu_vb * 1000kwu_wu = 250 sat_kwu // 1 sat_vb / 4wu_vb * 1000kwu_wu = 250 sat_kwu
let sat_kwu = (sat_vb * 250.0).ceil() as u64; let sat_kwu = (sat_vb * 250.0).ceil() as u64;
FeeRate::from_sat_per_kwu(sat_kwu) FeeRate::from_sat_per_kwu(sat_kwu)

View File

@ -13,16 +13,15 @@ use bdk::KeychainKind;
use bdk_chain::COINBASE_MATURITY; use bdk_chain::COINBASE_MATURITY;
use bdk_chain::{BlockId, ConfirmationTime}; use bdk_chain::{BlockId, ConfirmationTime};
use bitcoin::hashes::Hash; use bitcoin::hashes::Hash;
use bitcoin::psbt;
use bitcoin::script::PushBytesBuf;
use bitcoin::sighash::{EcdsaSighashType, TapSighashType}; use bitcoin::sighash::{EcdsaSighashType, TapSighashType};
use bitcoin::Amount; use bitcoin::taproot::TapNodeHash;
use bitcoin::FeeRate;
use bitcoin::ScriptBuf;
use bitcoin::{ use bitcoin::{
absolute, script::PushBytesBuf, taproot::TapNodeHash, Address, OutPoint, Sequence, Transaction, absolute, Address, Amount, BlockHash, FeeRate, Network, OutPoint, ScriptBuf, Sequence,
TxIn, TxOut, Weight, Transaction, TxIn, TxOut, Txid, Weight,
}; };
use bitcoin::{psbt, Network};
use bitcoin::{BlockHash, Txid};
mod common; mod common;
use common::*; use common::*;