wallet: rpc: Improve error message for low feerates. #34640

pull davidgumberg wants to merge 1 commits into bitcoin:master from davidgumberg:2026-02-20-send-minfee-msg changing 2 files +22 −2
  1. davidgumberg commented at 10:38 pm on February 20, 2026: contributor

    Giving the user a hint about what action to take when they encounter an error related to a feerate that is below the minimum. I encountered this myself not knowing about -mintxfee and the manpage was slightly less than clear,

    0       -mintxfee=<amt>
    1
    2              Fee rates (in BTC/kvB) smaller than this are considered zero fee for  transaction  creation
    3              (default: 0.00001)
    
  2. DrahtBot added the label Wallet on Feb 20, 2026
  3. DrahtBot commented at 10:39 pm on February 20, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ismaelsadeeq
    Concept ACK rkrux, musaHaruna

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. in src/wallet/rpc/spend.cpp:1438 in b77555c8fb
    1434@@ -1435,7 +1435,18 @@ RPCHelpMan sendall()
    1435             // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
    1436             // provided one
    1437             if (coin_control.m_feerate && fee_rate > *coin_control.m_feerate) {
    1438-                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)));
    1439+                const auto f = FeeRateFormat::SAT_VB;
    


    rkrux commented at 12:22 pm on February 25, 2026:
    Sure its usage is limited and bounded but calling it just f doesn’t help the reader much.

    davidgumberg commented at 0:39 am on March 11, 2026:
    Thanks, changed to feerate_format
  5. in src/wallet/rpc/spend.cpp:1447 in b77555c8fb
    1443+                if (fee_calc_out.reason == FeeReason::REQUIRED) {
    1444+                    msg += strprintf("\nConsider modifying %s (%s) or %s (%s).",
    1445+                        "-mintxfee",
    1446+                        pwallet->m_min_fee.ToString(f),
    1447+                        "-minrelaytxfee",
    1448+                        pwallet->chain().relayMinFee().ToString(f));
    


    rkrux commented at 12:26 pm on February 25, 2026:

    I don’t see a strong reason to add placeholders for hardcoded values. The following diff for succinctness?

     0--- a/src/wallet/rpc/spend.cpp
     1+++ b/src/wallet/rpc/spend.cpp
     2@@ -1440,10 +1440,8 @@ RPCHelpMan sendall()
     3                     coin_control.m_feerate->ToString(f),
     4                     fee_rate.ToString(f))};
     5                 if (fee_calc_out.reason == FeeReason::REQUIRED) {
     6-                    msg += strprintf("\nConsider modifying %s (%s) or %s (%s).",
     7-                        "-mintxfee",
     8+                    msg += strprintf("\nConsider modifying -mintxfee (%s) or -minrelaytxfee (%s).",
     9                         pwallet->m_min_fee.ToString(f),
    10-                        "-minrelaytxfee",
    11                         pwallet->chain().relayMinFee().ToString(f));
    12                 }
    

    davidgumberg commented at 0:48 am on March 11, 2026:

    This was copied and pasted from https://github.com/bitcoin/bitcoin/blob/b77555c8fba1e8c1cc25124e62302684fabdb32f/src/wallet/spend.cpp#L1160-L1166

    where using variables is necessary to avoid parameter names from being translated, hopefully in the future this logic will be consolidated and live exclusively in src/wallet/spend.cpp and so I tried to keep the two as similar as possible, but I’ll include it in the string since it’s not that important.

  6. rkrux commented at 12:33 pm on February 25, 2026: contributor
    Concept ACK for the intent to add an actionable message in case of this error.
  7. musaHaruna commented at 10:11 am on February 26, 2026: contributor

    Concept ACK on improving error message for low feerates

    Sure its usage is limited and bounded but calling it just f doesn’t help the reader much.

    Also agree with this comment. I think naming the variable format or fee_rate_format makes it more readable.

  8. fanquake commented at 12:29 pm on March 9, 2026: member
  9. wallet: rpc: Improve error message for low feerates. 98fcd7af23
  10. davidgumberg force-pushed on Mar 11, 2026
  11. davidgumberg commented at 0:51 am on March 11, 2026: contributor

    Pushed to address @rkrux’s feedback:

  12. ismaelsadeeq commented at 1:50 pm on March 11, 2026: member
    Concept ACK
  13. in src/wallet/spend.cpp:1164 in 98fcd7af23
    1160+            coin_selection_params.m_effective_feerate.ToString(feerate_format))};
    1161+        if (feeCalc.reason == FeeReason::REQUIRED) {
    1162+            msg += strprintf(_("\nConsider modifying %s (%s) or %s (%s)."),
    1163+                "-mintxfee",
    1164+                wallet.m_min_fee.ToString(feerate_format),
    1165+                "-minrelaytxfee",
    


    ismaelsadeeq commented at 10:11 am on March 12, 2026:
    nit: I like the approach in the src/wallet/rpc/spend.cpp where you just include mintxfee and minrelaytxfee in the msg string, it is less verbose than this.

    davidgumberg commented at 3:35 pm on March 12, 2026:
    Here it is necessary for the translation strings, we don’t want to include parameter names which should not be translated in format strings.
  14. in src/wallet/rpc/spend.cpp:1446 in 98fcd7af23
    1442+                    fee_rate.ToString(feerate_format))};
    1443+                if (fee_calc_out.reason == FeeReason::REQUIRED) {
    1444+                    msg += strprintf("\nConsider modifying -mintxfee (%s) or -minrelaytxfee (%s).",
    1445+                        pwallet->m_min_fee.ToString(feerate_format),
    1446+                        pwallet->chain().relayMinFee().ToString(feerate_format));
    1447+                }
    


    ismaelsadeeq commented at 11:36 am on March 12, 2026:
    Modifying -minrelaytxfee is potentially not a good idea for the user. They may modify and have the transaction created, but not propagated. So maybe clarify that?
  15. ismaelsadeeq commented at 11:37 am on March 12, 2026: member

    ACK 98fcd7af23f3628514a499936720fd0885886b30

    Should also test this e,g here and other places?

     0diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
     1index ab8f74f20e..1674341b99 100755
     2--- a/test/functional/wallet_send.py
     3+++ b/test/functional/wallet_send.py
     4@@ -328,7 +328,7 @@ class WalletSendTest(BitcoinTestFramework):
     5
     6         # Test setting explicit fee rate just below the minimum of 1 sat/vB.
     7         self.log.info("Explicit fee rate raises RPC error 'fee rate too low' if fee_rate of 0.99999999 is passed")
     8-        msg = "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
     9+        msg = "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB).\nConsider modifying -mintxfee (1.000 sat/vB) or -minrelaytxfee (0.100 sat/vB)."
    10         self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=0.999, expect_error=(-4, msg))
    11         self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=0.999, expect_error=(-4, msg))
    
  16. DrahtBot requested review from rkrux on Mar 12, 2026
  17. DrahtBot requested review from musaHaruna on Mar 12, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-24 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me