From: LLFourn Date: Tue, 5 Jan 2021 01:08:43 +0000 (+1100) Subject: Assert that `.finish()` hasn't been called already in coin_selection X-Git-Tag: v0.4.0~33 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/struct.OutOfRangeError.html?a=commitdiff_plain;h=735db0285094131bed4c13f533f6a89fb9a07e77;p=bdk Assert that `.finish()` hasn't been called already in coin_selection --- diff --git a/src/wallet/tx_builder.rs b/src/wallet/tx_builder.rs index 089aad43..a9ed5d8b 100644 --- a/src/wallet/tx_builder.rs +++ b/src/wallet/tx_builder.rs @@ -414,6 +414,10 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderConte self, coin_selection: P, ) -> TxBuilder<'a, B, D, P, Ctx> { + assert!( + self.coin_selection.is_some(), + "can't set coin_selection after finish() has been called" + ); TxBuilder { wallet: self.wallet, params: self.params,