Skip to content

Commit d77a7f2

Browse files
Merge #1344: tx_builder: Relax generic constraints on TxBuilder
2efa299 tx_builder: Relax generic constraints on TxBuilder (Steven Roose) Pull request description: Closes #1312 ACKs for top commit: danielabrozzoni: ACK 2efa299 Tree-SHA512: 6bfe052c22697eb910cf1f3d453e89f4432159fa017b38532d097cdc07b7a7c3b986be658b81e51acdb54cab999345ab463184e80c8eacefc73d77748c018992
2 parents 3d44ffa + 2efa299 commit d77a7f2

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

crates/bdk/src/wallet/tx_builder.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<'a, D, Cs: Clone, Ctx> Clone for TxBuilder<'a, D, Cs, Ctx> {
190190
}
191191

192192
// methods supported by both contexts, for any CoinSelectionAlgorithm
193-
impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderContext> TxBuilder<'a, D, Cs, Ctx> {
193+
impl<'a, D, Cs, Ctx> TxBuilder<'a, D, Cs, Ctx> {
194194
/// Set a custom fee rate
195195
/// The fee_rate method sets the mining fee paid by the transaction as a rate on its size.
196196
/// This means that the total fee paid is equal to this rate * size of the transaction in virtual Bytes (vB) or Weight Unit (wu).
@@ -574,20 +574,6 @@ impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderContext> TxBuilder<'a, D,
574574
}
575575
}
576576

577-
/// Finish building the transaction.
578-
///
579-
/// Returns a new [`Psbt`] per [`BIP174`].
580-
///
581-
/// [`BIP174`]: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
582-
pub fn finish(self) -> Result<Psbt, CreateTxError<D::WriteError>>
583-
where
584-
D: PersistBackend<ChangeSet>,
585-
{
586-
self.wallet
587-
.borrow_mut()
588-
.create_tx(self.coin_selection, self.params)
589-
}
590-
591577
/// Enable signaling RBF
592578
///
593579
/// This will use the default nSequence value of `0xFFFFFFFD`.
@@ -634,6 +620,22 @@ impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderContext> TxBuilder<'a, D,
634620
}
635621
}
636622

623+
impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx> TxBuilder<'a, D, Cs, Ctx> {
624+
/// Finish building the transaction.
625+
///
626+
/// Returns a new [`Psbt`] per [`BIP174`].
627+
///
628+
/// [`BIP174`]: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
629+
pub fn finish(self) -> Result<Psbt, CreateTxError<D::WriteError>>
630+
where
631+
D: PersistBackend<ChangeSet>,
632+
{
633+
self.wallet
634+
.borrow_mut()
635+
.create_tx(self.coin_selection, self.params)
636+
}
637+
}
638+
637639
#[derive(Debug)]
638640
/// Error returned from [`TxBuilder::add_utxo`] and [`TxBuilder::add_utxos`]
639641
pub enum AddUtxoError {

0 commit comments

Comments
 (0)