@@ -3124,10 +3124,10 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3124
3124
walletInstance->m_default_change_type = parsed.value();
3125
3125
}
3126
3126
3127
- if (args.IsArgSet ("-mintxfee")) {
3128
- std::optional<CAmount> min_tx_fee = ParseMoney(args.GetArg("-mintxfee", "") );
3127
+ if (const auto arg{ args.GetArg ("-mintxfee")} ) {
3128
+ std::optional<CAmount> min_tx_fee = ParseMoney(*arg );
3129
3129
if (!min_tx_fee) {
3130
- error = AmountErrMsg("mintxfee", args.GetArg("-mintxfee", "") );
3130
+ error = AmountErrMsg("mintxfee", *arg );
3131
3131
return nullptr;
3132
3132
} else if (min_tx_fee.value() > HIGH_TX_FEE_PER_KB) {
3133
3133
warnings.push_back(AmountHighWarn("-mintxfee") + Untranslated(" ") +
@@ -3137,8 +3137,8 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3137
3137
walletInstance->m_min_fee = CFeeRate{min_tx_fee.value()};
3138
3138
}
3139
3139
3140
- if (args.IsArgSet ("-maxapsfee")) {
3141
- const std::string max_aps_fee{args.GetArg("-maxapsfee", "") };
3140
+ if (const auto arg{ args.GetArg ("-maxapsfee")} ) {
3141
+ const std::string& max_aps_fee{*arg };
3142
3142
if (max_aps_fee == "-1") {
3143
3143
walletInstance->m_max_aps_fee = -1;
3144
3144
} else if (std::optional<CAmount> max_fee = ParseMoney(max_aps_fee)) {
@@ -3153,10 +3153,10 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3153
3153
}
3154
3154
}
3155
3155
3156
- if (args.IsArgSet ("-fallbackfee")) {
3157
- std::optional<CAmount> fallback_fee = ParseMoney(args.GetArg("-fallbackfee", "") );
3156
+ if (const auto arg{ args.GetArg ("-fallbackfee")} ) {
3157
+ std::optional<CAmount> fallback_fee = ParseMoney(*arg );
3158
3158
if (!fallback_fee) {
3159
- error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-fallbackfee", args.GetArg("-fallbackfee", "") );
3159
+ error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-fallbackfee", *arg );
3160
3160
return nullptr;
3161
3161
} else if (fallback_fee.value() > HIGH_TX_FEE_PER_KB) {
3162
3162
warnings.push_back(AmountHighWarn("-fallbackfee") + Untranslated(" ") +
@@ -3168,10 +3168,10 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3168
3168
// Disable fallback fee in case value was set to 0, enable if non-null value
3169
3169
walletInstance->m_allow_fallback_fee = walletInstance->m_fallback_fee.GetFeePerK() != 0;
3170
3170
3171
- if (args.IsArgSet ("-discardfee")) {
3172
- std::optional<CAmount> discard_fee = ParseMoney(args.GetArg("-discardfee", "") );
3171
+ if (const auto arg{ args.GetArg ("-discardfee")} ) {
3172
+ std::optional<CAmount> discard_fee = ParseMoney(*arg );
3173
3173
if (!discard_fee) {
3174
- error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-discardfee", args.GetArg("-discardfee", "") );
3174
+ error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-discardfee", *arg );
3175
3175
return nullptr;
3176
3176
} else if (discard_fee.value() > HIGH_TX_FEE_PER_KB) {
3177
3177
warnings.push_back(AmountHighWarn("-discardfee") + Untranslated(" ") +
@@ -3180,12 +3180,12 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3180
3180
walletInstance->m_discard_rate = CFeeRate{discard_fee.value()};
3181
3181
}
3182
3182
3183
- if (args.IsArgSet ("-paytxfee")) {
3183
+ if (const auto arg{ args.GetArg ("-paytxfee")} ) {
3184
3184
warnings.push_back(_("-paytxfee is deprecated and will be fully removed in v31.0."));
3185
3185
3186
- std::optional<CAmount> pay_tx_fee = ParseMoney(args.GetArg("-paytxfee", "") );
3186
+ std::optional<CAmount> pay_tx_fee = ParseMoney(*arg );
3187
3187
if (!pay_tx_fee) {
3188
- error = AmountErrMsg("paytxfee", args.GetArg("-paytxfee", "") );
3188
+ error = AmountErrMsg("paytxfee", *arg );
3189
3189
return nullptr;
3190
3190
} else if (pay_tx_fee.value() > HIGH_TX_FEE_PER_KB) {
3191
3191
warnings.push_back(AmountHighWarn("-paytxfee") + Untranslated(" ") +
@@ -3196,34 +3196,34 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3196
3196
3197
3197
if (chain && walletInstance->m_pay_tx_fee < chain->relayMinFee()) {
3198
3198
error = strprintf(_("Invalid amount for %s=<amount>: '%s' (must be at least %s)"),
3199
- "-paytxfee", args.GetArg("-paytxfee", "") , chain->relayMinFee().ToString());
3199
+ "-paytxfee", *arg , chain->relayMinFee().ToString());
3200
3200
return nullptr;
3201
3201
}
3202
3202
}
3203
3203
3204
- if (args.IsArgSet ("-maxtxfee")) {
3205
- std::optional<CAmount> max_fee = ParseMoney(args.GetArg("-maxtxfee", "") );
3204
+ if (const auto arg{ args.GetArg ("-maxtxfee")} ) {
3205
+ std::optional<CAmount> max_fee = ParseMoney(*arg );
3206
3206
if (!max_fee) {
3207
- error = AmountErrMsg("maxtxfee", args.GetArg("-maxtxfee", "") );
3207
+ error = AmountErrMsg("maxtxfee", *arg );
3208
3208
return nullptr;
3209
3209
} else if (max_fee.value() > HIGH_MAX_TX_FEE) {
3210
3210
warnings.push_back(strprintf(_("%s is set very high! Fees this large could be paid on a single transaction."), "-maxtxfee"));
3211
3211
}
3212
3212
3213
3213
if (chain && CFeeRate{max_fee.value(), 1000} < chain->relayMinFee()) {
3214
3214
error = strprintf(_("Invalid amount for %s=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
3215
- "-maxtxfee", args.GetArg("-maxtxfee", "") , chain->relayMinFee().ToString());
3215
+ "-maxtxfee", *arg , chain->relayMinFee().ToString());
3216
3216
return nullptr;
3217
3217
}
3218
3218
3219
3219
walletInstance->m_default_max_tx_fee = max_fee.value();
3220
3220
}
3221
3221
3222
- if (args.IsArgSet ("-consolidatefeerate")) {
3223
- if (std::optional<CAmount> consolidate_feerate = ParseMoney(args.GetArg("-consolidatefeerate", "") )) {
3222
+ if (const auto arg{ args.GetArg ("-consolidatefeerate")} ) {
3223
+ if (std::optional<CAmount> consolidate_feerate = ParseMoney(*arg )) {
3224
3224
walletInstance->m_consolidate_feerate = CFeeRate(*consolidate_feerate);
3225
3225
} else {
3226
- error = AmountErrMsg("consolidatefeerate", args.GetArg("-consolidatefeerate", "") );
3226
+ error = AmountErrMsg("consolidatefeerate", *arg );
3227
3227
return nullptr;
3228
3228
}
3229
3229
}
0 commit comments