wallet: rpc: Improve error message for low feerates.
What changed, and why it matters
This commit only improves the wording of an error message shown when a user sets a transaction fee rate that is too low. It adds suggestions to adjust wallet or network fee settings. There is no code behavior change, no bug fix, and no security impact.
No security action needed; treat as a routine UX improvement.
Security signals we found
No security signal: change is purely a user-facing error-message improvement.
No memory safety, cryptographic, consensus, authorization, or input validation changes.
Evidence from the diff
The patch modifies two wallet spend code paths (RPC sendall and internal CreateTransaction) to append a hint to an existing error string when the effective fee rate was raised because of a REQUIRED minimum (e.g., -mintxfee or -minrelaytxfee). The conditional check and error throwing logic are unchanged; only the human-readable message is enhanced.
Changed components
src/wallet/rpc/spend.cppsrc/wallet/spend.cppInspect captured patch +22 / −2
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index d8424183..7401b82e 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1435,7 +1435,16 @@ RPCHelpMan sendall()
// Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
// provided one
if (coin_control.m_feerate && fee_rate > *coin_control.m_feerate) {
- throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Fee rate (%s) is lower than the minimum fee rate setting (%s)", coin_control.m_feerate->ToString(FeeRateFormat::SAT_VB), fee_rate.ToString(FeeRateFormat::SAT_VB)));
+ const auto feerate_format = FeeRateFormat::SAT_VB;
+ auto msg{strprintf("Fee rate (%s) is lower than the minimum fee rate setting (%s).",
+ coin_control.m_feerate->ToString(feerate_format),
+ fee_rate.ToString(feerate_format))};
+ if (fee_calc_out.reason == FeeReason::REQUIRED) {
+ msg += strprintf("\nConsider modifying -mintxfee (%s) or -minrelaytxfee (%s).",
+ pwallet->m_min_fee.ToString(feerate_format),
+ pwallet->chain().relayMinFee().ToString(feerate_format));
+ }
+ throw JSONRPCError(RPC_INVALID_PARAMETER, msg);
}
if (fee_calc_out.reason == FeeReason::FALLBACK && !pwallet->m_allow_fallback_fee) {
// eventually allow a fallback fee
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 9ba507f4..2182e1a2 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -1153,7 +1153,18 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
// Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
// provided one
if (coin_control.m_feerate && coin_selection_params.m_effective_feerate > *coin_control.m_feerate) {
- return util::Error{strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(FeeRateFormat::SAT_VB), coin_selection_params.m_effective_feerate.ToString(FeeRateFormat::SAT_VB))};
+ const auto feerate_format = FeeRateFormat::SAT_VB;
+ auto msg{strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)."),
+ coin_control.m_feerate->ToString(feerate_format),
+ coin_selection_params.m_effective_feerate.ToString(feerate_format))};
+ if (feeCalc.reason == FeeReason::REQUIRED) {
+ msg += strprintf(_("\nConsider modifying %s (%s) or %s (%s)."),
+ "-mintxfee",
+ wallet.m_min_fee.ToString(feerate_format),
+ "-minrelaytxfee",
+ wallet.chain().relayMinFee().ToString(feerate_format));
+ }
+ return util::Error{msg};
}
if (feeCalc.reason == FeeReason::FALLBACK && !wallet.m_allow_fallback_fee) {
// eventually allow a fallback fee
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.