///
/// 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.
-#[derive(Debug, Default)]
+#[derive(Debug, Default, Clone, Copy)]
pub struct LargestFirstCoinSelection;
impl<D: Database> CoinSelectionAlgorithm<D> for LargestFirstCoinSelection {
/// [`build_fee_bump`]: Wallet::build_fee_bump
/// [`finish`]: Self::finish
/// [`coin_selection`]: Self::coin_selection
-#[derive(Clone, Debug)]
+#[derive(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
}
}
+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
impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>, Ctx: TxBuilderContext>
TxBuilder<'a, B, D, Cs, Ctx>