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,

           -mintxfee=<amt>
    
                  Fee rates (in BTC/kvB) smaller than this are considered zero fee for  transaction  creation
                  (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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ismaelsadeeq, w0xlt, achow101
    Concept ACK rkrux, musaHaruna

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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 12: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?

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

    davidgumberg commented at 12: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 12: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?


    davidgumberg commented at 1:10 AM on March 25, 2026:

    The same is true of mintxfee, maybe a more general warning is in order about modifying default values that may cause your node to produce transactions which others might not relay?

  15. ismaelsadeeq commented at 11:37 AM on March 12, 2026: member

    ACK 98fcd7af23f3628514a499936720fd0885886b30

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

    diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
    index ab8f74f20e..1674341b99 100755
    --- a/test/functional/wallet_send.py
    +++ b/test/functional/wallet_send.py
    @@ -328,7 +328,7 @@ class WalletSendTest(BitcoinTestFramework):
    
             # Test setting explicit fee rate just below the minimum of 1 sat/vB.
             self.log.info("Explicit fee rate raises RPC error 'fee rate too low' if fee_rate of 0.99999999 is passed")
    -        msg = "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
    +        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)."
             self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=0.999, expect_error=(-4, msg))
             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
  18. w0xlt commented at 9:54 PM on March 26, 2026: contributor

    ACK 98fcd7af23f3628514a499936720fd0885886b30

    Maybe a common helper can de-duplicate the code.

  19. achow101 commented at 6:24 PM on March 31, 2026: member

    ACK 98fcd7af23f3628514a499936720fd0885886b30

  20. achow101 merged this on Mar 31, 2026
  21. achow101 closed this on Mar 31, 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-04-14 18:12 UTC

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