Skip to content

Commit fac4e13

Browse files
author
MarcoFalke
committed
refactor: Change pointer to reference because it can not be null
1 parent 831675c commit fac4e13

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static std::string LabelFromValue(const UniValue& value)
198198
/**
199199
* Update coin control with fee estimation based on the given parameters
200200
*
201-
* @param[in] pwallet Wallet pointer
201+
* @param[in] wallet Wallet reference
202202
* @param[in,out] cc Coin control to be updated
203203
* @param[in] conf_target UniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h;
204204
* 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)
210210
* verify only that fee_rate is greater than 0
211211
* @throws a JSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict
212212
*/
213-
static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
213+
static void SetFeeEstimateMode(const CWallet& wallet, CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
214214
{
215215
if (!fee_rate.isNull()) {
216216
if (!conf_target.isNull() && conf_target.get_int() > 0) {
@@ -235,7 +235,7 @@ static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const U
235235
throw JSONRPCError(RPC_INVALID_PARAMETER, InvalidEstimateModeErrorMessage());
236236
}
237237
if (!conf_target.isNull()) {
238-
cc.m_confirm_target = ParseConfirmTarget(conf_target, pwallet->chain().estimateMaxBlocks());
238+
cc.m_confirm_target = ParseConfirmTarget(conf_target, wallet.chain().estimateMaxBlocks());
239239
}
240240
}
241241

@@ -514,7 +514,7 @@ static RPCHelpMan sendtoaddress()
514514
// We also enable partial spend avoidance if reuse avoidance is set.
515515
coin_control.m_avoid_partial_spends |= coin_control.m_avoid_address_reuse;
516516

517-
SetFeeEstimateMode(pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[9], /* override_min_fee */ false);
517+
SetFeeEstimateMode(*pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[9], /* override_min_fee */ false);
518518

519519
EnsureWalletIsUnlocked(pwallet);
520520

@@ -942,7 +942,7 @@ static RPCHelpMan sendmany()
942942
coin_control.m_signal_bip125_rbf = request.params[5].get_bool();
943943
}
944944

945-
SetFeeEstimateMode(pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[8], /* override_min_fee */ false);
945+
SetFeeEstimateMode(*pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[8], /* override_min_fee */ false);
946946

947947
std::vector<CRecipient> recipients;
948948
ParseRecipients(sendTo, subtractFeeFromAmount, recipients);
@@ -3164,7 +3164,7 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f
31643164
if (options.exists("replaceable")) {
31653165
coinControl.m_signal_bip125_rbf = options["replaceable"].get_bool();
31663166
}
3167-
SetFeeEstimateMode(pwallet, coinControl, options["conf_target"], options["estimate_mode"], options["fee_rate"], override_min_fee);
3167+
SetFeeEstimateMode(*pwallet, coinControl, options["conf_target"], options["estimate_mode"], options["fee_rate"], override_min_fee);
31683168
}
31693169
} else {
31703170
// if options is null and not a bool
@@ -3492,7 +3492,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name)
34923492
if (options.exists("replaceable")) {
34933493
coin_control.m_signal_bip125_rbf = options["replaceable"].get_bool();
34943494
}
3495-
SetFeeEstimateMode(pwallet, coin_control, conf_target, options["estimate_mode"], options["fee_rate"], /* override_min_fee */ false);
3495+
SetFeeEstimateMode(*pwallet, coin_control, conf_target, options["estimate_mode"], options["fee_rate"], /* override_min_fee */ false);
34963496
}
34973497

34983498
// Make sure the results are valid at least up to the most recent block

0 commit comments

Comments
 (0)