Derive Clone + Debug for TxBuilder
And make Wallet Debug while I'm at it.
This commit is contained in:
parent
10fcba9439
commit
6fe3be0243
@ -35,6 +35,7 @@ use bitcoin::hashes::hex::FromHex;
|
||||
use bitcoin::util::bip32::Fingerprint;
|
||||
use bitcoin::{Network, Script};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct DummyValidator;
|
||||
impl AddressValidator for DummyValidator {
|
||||
fn validate(
|
||||
|
@ -45,6 +45,7 @@
|
||||
//! # use bdk::address_validator::*;
|
||||
//! # use bdk::database::*;
|
||||
//! # use bdk::*;
|
||||
//! #[derive(Debug)]
|
||||
//! struct PrintAddressAndContinue;
|
||||
//!
|
||||
//! impl AddressValidator for PrintAddressAndContinue {
|
||||
@ -111,7 +112,7 @@ impl std::error::Error for AddressValidatorError {}
|
||||
/// validator will be propagated up to the original caller that triggered the address generation.
|
||||
///
|
||||
/// For a usage example see [this module](crate::address_validator)'s documentation.
|
||||
pub trait AddressValidator: Send + Sync {
|
||||
pub trait AddressValidator: Send + Sync + fmt::Debug {
|
||||
/// Validate or inspect an address
|
||||
fn validate(
|
||||
&self,
|
||||
@ -128,6 +129,7 @@ mod test {
|
||||
use super::*;
|
||||
use crate::wallet::test::{get_funded_wallet, get_test_wpkh};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct TestValidator;
|
||||
impl AddressValidator for TestValidator {
|
||||
fn validate(
|
||||
|
@ -87,6 +87,7 @@ const CACHE_ADDR_BATCH_SIZE: u32 = 100;
|
||||
/// A wallet can be either "online" if the [`blockchain`](crate::blockchain) type provided
|
||||
/// implements [`Blockchain`], or "offline" if it is the unit type `()`. Offline wallets only expose
|
||||
/// methods that don't need any interaction with the blockchain to work.
|
||||
#[derive(Debug)]
|
||||
pub struct Wallet<B, D> {
|
||||
descriptor: ExtendedDescriptor,
|
||||
change_descriptor: Option<ExtendedDescriptor>,
|
||||
|
@ -127,6 +127,7 @@ impl TxBuilderContext for BumpFee {}
|
||||
/// [`build_fee_bump`]: Wallet::build_fee_bump
|
||||
/// [`finish`]: Self::finish
|
||||
/// [`coin_selection`]: Self::coin_selection
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TxBuilder<'a, B, D, Cs, Ctx> {
|
||||
pub(crate) wallet: &'a Wallet<B, D>,
|
||||
// params and coin_selection are Options not becasue they are optionally set (they are always
|
||||
@ -139,7 +140,7 @@ pub struct TxBuilder<'a, B, D, Cs, Ctx> {
|
||||
|
||||
/// The parameters for transaction creation sans coin selection algorithm.
|
||||
//TODO: TxParams should eventually be exposed publicly.
|
||||
#[derive(Default, Debug)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub(crate) struct TxParams {
|
||||
pub(crate) recipients: Vec<(Script, u64)>,
|
||||
pub(crate) drain_wallet: bool,
|
||||
@ -168,7 +169,7 @@ pub(crate) struct PreviousFee {
|
||||
pub rate: f32,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) enum FeePolicy {
|
||||
FeeRate(FeeRate),
|
||||
FeeAmount(u64),
|
||||
|
Loading…
x
Reference in New Issue
Block a user