@@ -408,6 +408,8 @@ impl TxBuilder {
408408 }
409409}
410410
411+ /// A `BumpFeeTxBuilder` is created by calling `build_fee_bump` on a wallet. After assigning it, you set options on it
412+ /// until finally calling `finish` to consume the builder and generate the transaction.
411413#[ derive( Clone , uniffi:: Object ) ]
412414pub ( crate ) struct BumpFeeTxBuilder {
413415 pub ( crate ) txid : String ,
@@ -433,41 +435,74 @@ impl BumpFeeTxBuilder {
433435 }
434436 }
435437
438+ /// Set an exact `nSequence` value.
439+ ///
440+ /// This can cause conflicts if the wallet’s descriptors contain an "older" (`OP_CSV`) operator and the given
441+ /// `nsequence` is lower than the CSV value.
436442 pub ( crate ) fn set_exact_sequence ( & self , nsequence : u32 ) -> Arc < Self > {
437443 Arc :: new ( BumpFeeTxBuilder {
438444 sequence : Some ( nsequence) ,
439445 ..self . clone ( )
440446 } )
441447 }
442448
449+ /// Set the current blockchain height.
450+ ///
451+ /// This will be used to:
452+ ///
453+ /// 1. Set the `nLockTime` for preventing fee sniping. Note: This will be ignored if you manually specify a
454+ /// `nlocktime` using `TxBuilder::nlocktime`.
455+ ///
456+ /// 2. Decide whether coinbase outputs are mature or not. If the coinbase outputs are not mature at `current_height`,
457+ /// we ignore them in the coin selection. If you want to create a transaction that spends immature coinbase inputs,
458+ /// manually add them using `TxBuilder::add_utxos`.
459+ /// In both cases, if you don’t provide a current height, we use the last sync height.
443460 pub ( crate ) fn current_height ( & self , height : u32 ) -> Arc < Self > {
444461 Arc :: new ( BumpFeeTxBuilder {
445462 current_height : Some ( height) ,
446463 ..self . clone ( )
447464 } )
448465 }
449466
467+ /// Use a specific nLockTime while creating the transaction.
468+ ///
469+ /// This can cause conflicts if the wallet’s descriptors contain an "after" (`OP_CLTV`) operator.
450470 pub ( crate ) fn nlocktime ( & self , locktime : LockTime ) -> Arc < Self > {
451471 Arc :: new ( BumpFeeTxBuilder {
452472 locktime : Some ( locktime) ,
453473 ..self . clone ( )
454474 } )
455475 }
456476
477+ /// Set whether the dust limit is checked.
478+ ///
479+ /// Note: by avoiding a dust limit check you may end up with a transaction that is non-standard.
457480 pub ( crate ) fn allow_dust ( & self , allow_dust : bool ) -> Arc < Self > {
458481 Arc :: new ( BumpFeeTxBuilder {
459482 allow_dust,
460483 ..self . clone ( )
461484 } )
462485 }
463486
487+ /// Build a transaction with a specific version.
488+ ///
489+ /// The version should always be greater than 0 and greater than 1 if the wallet’s descriptors contain an "older"
490+ /// (`OP_CSV`) operator.
464491 pub ( crate ) fn version ( & self , version : i32 ) -> Arc < Self > {
465492 Arc :: new ( BumpFeeTxBuilder {
466493 version : Some ( version) ,
467494 ..self . clone ( )
468495 } )
469496 }
470497
498+ /// Finish building the transaction.
499+ ///
500+ /// Uses the thread-local random number generator (rng).
501+ ///
502+ /// Returns a new `Psbt` per BIP174.
503+ ///
504+ /// WARNING: To avoid change address reuse you must persist the changes resulting from one or more calls to this
505+ /// method before closing the wallet. See `Wallet::reveal_next_address`.
471506 pub ( crate ) fn finish ( & self , wallet : & Arc < Wallet > ) -> Result < Arc < Psbt > , CreateTxError > {
472507 let txid = Txid :: from_str ( self . txid . as_str ( ) ) . map_err ( |_| CreateTxError :: UnknownUtxo {
473508 outpoint : self . txid . clone ( ) ,
0 commit comments