@@ -2837,6 +2837,9 @@ impl Wallet {
28372837 /// Creates a PSBT with the given `params` and returns the updated [`Psbt`] and
28382838 /// [`Finalizer`].
28392839 ///
2840+ /// This function uses the thread-local random number generator (RNG) to generate
2841+ /// randomness. To supply your own source of entropy see [`Wallet::create_psbt_with_rng`].
2842+ ///
28402843 /// # Example
28412844 ///
28422845 /// ```rust,no_run
@@ -2857,21 +2860,31 @@ impl Wallet {
28572860 /// let (psbt, finalizer) = wallet.create_psbt(params)?;
28582861 /// # Ok::<_, anyhow::Error>(())
28592862 /// ```
2863+ ///
2864+ /// # Errors
2865+ ///
2866+ /// A [`CreatePsbtError`] will be thrown if any of the following occurs
2867+ ///
2868+ /// - A manually selected input is missing from the wallet, or could not be planned
2869+ /// - The input value is insufficient to fund the outputs
2870+ /// - Failure to complete coin selection
2871+ /// - Failure to create or update the PSBT.
28602872 #[ cfg( feature = "std" ) ]
28612873 #[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
28622874 pub fn create_psbt ( & self , params : PsbtParams ) -> Result < ( Psbt , Finalizer ) , CreatePsbtError > {
2863- self . create_psbt_with_aux_rand ( params, & mut rand:: thread_rng ( ) )
2875+ self . create_psbt_with_rng ( params, & mut rand:: thread_rng ( ) )
28642876 }
28652877
2866- /// Creates a PSBT with the given `params` and auxiliary randomness .
2878+ /// Creates a PSBT with the given `params` and random number generator (RNG) .
28672879 ///
2868- /// ### Parameters:
2880+ /// Return the updated [`Psbt`] and [`Finalizer`].
28692881 ///
2870- /// - `params`: [`PsbtParams`]
2871- /// - `rng`: Source of entropy, may be used during coin selection.
2882+ /// ## Parameters:
28722883 ///
2873- /// Returns the updated [`Psbt`] and [`Finalizer`].
2874- pub fn create_psbt_with_aux_rand (
2884+ /// - `params`: [`PsbtParams`]
2885+ /// - `rng`: Source of entropy, may be used during coin selection and to sort inputs and outputs
2886+ /// by the [`TxOrdering`](crate::wallet::tx_builder::TxOrdering).
2887+ pub fn create_psbt_with_rng (
28752888 & self ,
28762889 params : PsbtParams ,
28772890 rng : & mut impl RngCore ,
@@ -3020,7 +3033,7 @@ impl Wallet {
30203033 /// [`Finalizer`].
30213034 ///
30223035 /// This is a convenience for getting a new [`ReplaceParams`], and updating the recipients
3023- /// and feerate before calling [`replace_by_fee_with_aux_rand `]. If further configuration is
3036+ /// and feerate before calling [`Wallet::replace_by_fee_with_rng `]. If further configuration is
30243037 /// desired, consider using [`PsbtParams::replace`] instead.
30253038 ///
30263039 /// # Example
@@ -3053,7 +3066,7 @@ impl Wallet {
30533066 feerate : FeeRate ,
30543067 recipients : Vec < ( ScriptBuf , Amount ) > ,
30553068 ) -> Result < ( Psbt , Finalizer ) , ReplaceByFeeError > {
3056- self . replace_by_fee_with_aux_rand (
3069+ self . replace_by_fee_with_rng (
30573070 ReplaceParams :: new (
30583071 txs,
30593072 PsbtParams {
@@ -3069,25 +3082,35 @@ impl Wallet {
30693082 /// Creates a Replace-By-Fee transaction (RBF) and returns the updated [`Psbt`] and
30703083 /// [`Finalizer`].
30713084 ///
3072- /// ### Parameters:
3085+ /// This function uses the thread-local random number generator (RNG) to generate
3086+ /// randomness. To supply your own source of entropy see [`Wallet::replace_by_fee_with_rng`].
30733087 ///
3074- /// - `params`: [`ReplaceParams`]
3088+ /// # Errors
3089+ ///
3090+ /// A [`ReplaceByFeeError`] will be thrown if any of the following occurs
3091+ ///
3092+ /// - An original transaction is missing from the wallet
3093+ /// - Failure to calculate the [fee](Wallet::calculate_fee) of an original transaction
3094+ /// - Failure to complete coin selection
3095+ /// - Failure to create or update the PSBT.
30753096 #[ cfg( feature = "std" ) ]
3097+ #[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
30763098 pub fn replace_by_fee (
30773099 & self ,
30783100 params : ReplaceParams ,
30793101 ) -> Result < ( Psbt , Finalizer ) , ReplaceByFeeError > {
3080- self . replace_by_fee_with_aux_rand ( params, & mut rand:: thread_rng ( ) )
3102+ self . replace_by_fee_with_rng ( params, & mut rand:: thread_rng ( ) )
30813103 }
30823104
30833105 /// Creates a Replace-By-Fee transaction (RBF) and returns the updated [`Psbt`] and
30843106 /// [`Finalizer`].
30853107 ///
3086- /// ### Parameters:
3108+ /// ## Parameters:
30873109 ///
30883110 /// - `params`: [`ReplaceParams`]
3089- /// - `rng`: Source of entropy, may be used during coin selection.
3090- pub fn replace_by_fee_with_aux_rand (
3111+ /// - `rng`: Source of entropy, may be used during coin selection and to sort inputs and outputs
3112+ /// by the [`TxOrdering`](crate::wallet::tx_builder::TxOrdering).
3113+ pub fn replace_by_fee_with_rng (
30913114 & self ,
30923115 params : ReplaceParams ,
30933116 rng : & mut impl RngCore ,
0 commit comments