mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-16 21:20:43 +02:00
refactor: Change pointer to reference because it can not be null
This commit is contained in:
parent
831675c8dc
commit
fac4e136fa
@ -198,7 +198,7 @@ static std::string LabelFromValue(const UniValue& value)
|
|||||||
/**
|
/**
|
||||||
* Update coin control with fee estimation based on the given parameters
|
* Update coin control with fee estimation based on the given parameters
|
||||||
*
|
*
|
||||||
* @param[in] pwallet Wallet pointer
|
* @param[in] wallet Wallet reference
|
||||||
* @param[in,out] cc Coin control to be updated
|
* @param[in,out] cc Coin control to be updated
|
||||||
* @param[in] conf_target UniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h;
|
* @param[in] conf_target UniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h;
|
||||||
* if a fee_rate is present, 0 is allowed here as a no-op positional placeholder
|
* if a fee_rate is present, 0 is allowed here as a no-op positional placeholder
|
||||||
@ -210,7 +210,7 @@ static std::string LabelFromValue(const UniValue& value)
|
|||||||
* verify only that fee_rate is greater than 0
|
* verify only that fee_rate is greater than 0
|
||||||
* @throws a JSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict
|
* @throws a JSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict
|
||||||
*/
|
*/
|
||||||
static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
|
static void SetFeeEstimateMode(const CWallet& wallet, CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
|
||||||
{
|
{
|
||||||
if (!fee_rate.isNull()) {
|
if (!fee_rate.isNull()) {
|
||||||
if (!conf_target.isNull() && conf_target.get_int() > 0) {
|
if (!conf_target.isNull() && conf_target.get_int() > 0) {
|
||||||
@ -235,7 +235,7 @@ static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const U
|
|||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, InvalidEstimateModeErrorMessage());
|
throw JSONRPCError(RPC_INVALID_PARAMETER, InvalidEstimateModeErrorMessage());
|
||||||
}
|
}
|
||||||
if (!conf_target.isNull()) {
|
if (!conf_target.isNull()) {
|
||||||
cc.m_confirm_target = ParseConfirmTarget(conf_target, pwallet->chain().estimateMaxBlocks());
|
cc.m_confirm_target = ParseConfirmTarget(conf_target, wallet.chain().estimateMaxBlocks());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ static RPCHelpMan sendtoaddress()
|
|||||||
// We also enable partial spend avoidance if reuse avoidance is set.
|
// We also enable partial spend avoidance if reuse avoidance is set.
|
||||||
coin_control.m_avoid_partial_spends |= coin_control.m_avoid_address_reuse;
|
coin_control.m_avoid_partial_spends |= coin_control.m_avoid_address_reuse;
|
||||||
|
|
||||||
SetFeeEstimateMode(pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[9], /* override_min_fee */ false);
|
SetFeeEstimateMode(*pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[9], /* override_min_fee */ false);
|
||||||
|
|
||||||
EnsureWalletIsUnlocked(pwallet);
|
EnsureWalletIsUnlocked(pwallet);
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ static RPCHelpMan sendmany()
|
|||||||
coin_control.m_signal_bip125_rbf = request.params[5].get_bool();
|
coin_control.m_signal_bip125_rbf = request.params[5].get_bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFeeEstimateMode(pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[8], /* override_min_fee */ false);
|
SetFeeEstimateMode(*pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[8], /* override_min_fee */ false);
|
||||||
|
|
||||||
std::vector<CRecipient> recipients;
|
std::vector<CRecipient> recipients;
|
||||||
ParseRecipients(sendTo, subtractFeeFromAmount, recipients);
|
ParseRecipients(sendTo, subtractFeeFromAmount, recipients);
|
||||||
@ -3164,7 +3164,7 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f
|
|||||||
if (options.exists("replaceable")) {
|
if (options.exists("replaceable")) {
|
||||||
coinControl.m_signal_bip125_rbf = options["replaceable"].get_bool();
|
coinControl.m_signal_bip125_rbf = options["replaceable"].get_bool();
|
||||||
}
|
}
|
||||||
SetFeeEstimateMode(pwallet, coinControl, options["conf_target"], options["estimate_mode"], options["fee_rate"], override_min_fee);
|
SetFeeEstimateMode(*pwallet, coinControl, options["conf_target"], options["estimate_mode"], options["fee_rate"], override_min_fee);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if options is null and not a bool
|
// if options is null and not a bool
|
||||||
@ -3492,7 +3492,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name)
|
|||||||
if (options.exists("replaceable")) {
|
if (options.exists("replaceable")) {
|
||||||
coin_control.m_signal_bip125_rbf = options["replaceable"].get_bool();
|
coin_control.m_signal_bip125_rbf = options["replaceable"].get_bool();
|
||||||
}
|
}
|
||||||
SetFeeEstimateMode(pwallet, coin_control, conf_target, options["estimate_mode"], options["fee_rate"], /* override_min_fee */ false);
|
SetFeeEstimateMode(*pwallet, coin_control, conf_target, options["estimate_mode"], options["fee_rate"], /* override_min_fee */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the results are valid at least up to the most recent block
|
// Make sure the results are valid at least up to the most recent block
|
||||||
|
Loading…
Reference in New Issue
Block a user