Make TxBuilder actually Clone
it derived Clone but in practice it was never clone because some of the parameters were not Clone.
This commit is contained in:
parent
a7183f34ef
commit
9a918f285d
@ -163,7 +163,7 @@ pub trait CoinSelectionAlgorithm<D: Database>: std::fmt::Debug {
|
|||||||
///
|
///
|
||||||
/// This coin selection algorithm sorts the available UTXOs by value and then picks them starting
|
/// This coin selection algorithm sorts the available UTXOs by value and then picks them starting
|
||||||
/// from the largest ones until the required amount is reached.
|
/// from the largest ones until the required amount is reached.
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, Copy)]
|
||||||
pub struct LargestFirstCoinSelection;
|
pub struct LargestFirstCoinSelection;
|
||||||
|
|
||||||
impl<D: Database> CoinSelectionAlgorithm<D> for LargestFirstCoinSelection {
|
impl<D: Database> CoinSelectionAlgorithm<D> for LargestFirstCoinSelection {
|
||||||
|
@ -129,7 +129,7 @@ impl TxBuilderContext for BumpFee {}
|
|||||||
/// [`build_fee_bump`]: Wallet::build_fee_bump
|
/// [`build_fee_bump`]: Wallet::build_fee_bump
|
||||||
/// [`finish`]: Self::finish
|
/// [`finish`]: Self::finish
|
||||||
/// [`coin_selection`]: Self::coin_selection
|
/// [`coin_selection`]: Self::coin_selection
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
pub struct TxBuilder<'a, B, D, Cs, Ctx> {
|
pub struct TxBuilder<'a, B, D, Cs, Ctx> {
|
||||||
pub(crate) wallet: &'a Wallet<B, D>,
|
pub(crate) wallet: &'a Wallet<B, D>,
|
||||||
// params and coin_selection are Options not becasue they are optionally set (they are always
|
// params and coin_selection are Options not becasue they are optionally set (they are always
|
||||||
@ -183,6 +183,17 @@ impl std::default::Default for FeePolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, Cs: Clone, Ctx, B, D> Clone for TxBuilder<'a, B, D, Cs, Ctx> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
TxBuilder {
|
||||||
|
wallet: self.wallet,
|
||||||
|
params: self.params.clone(),
|
||||||
|
coin_selection: self.coin_selection.clone(),
|
||||||
|
phantom: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// methods supported by both contexts, for any CoinSelectionAlgorithm
|
// methods supported by both contexts, for any CoinSelectionAlgorithm
|
||||||
impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>, Ctx: TxBuilderContext>
|
impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>, Ctx: TxBuilderContext>
|
||||||
TxBuilder<'a, B, D, Cs, Ctx>
|
TxBuilder<'a, B, D, Cs, Ctx>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user