Add absurdly high fee message to validation state #5913

pull shaulkf wants to merge 1 commits into bitcoin:master from shaulkf:add-absurd-fee-message changing 3 files +11 −7
  1. shaulkf commented at 2:08 AM on March 17, 2015: contributor

    Currently error message isn't propagating to RPC. Not sure how reject constants should be numbered, for now I arbitrarily chose 0x44, please advise.

  2. sipa commented at 9:53 AM on March 17, 2015: member

    There is no need for a reject code, as this can never trigger for peer-to-peer initiated transactions, so it can never result in a reject message.

    If you really need a reject code, add a REJECT_LOCAL or something, reserved for conditions that can only trigger locally (and mark it is an implementation detail, not related to BIP 61.

  3. sipa cross-referenced this on Mar 17, 2015 from issue Insane fee check doesn't return clear error to the sendrawtransaction RPC by Michagogo
  4. shaulkf commented at 1:02 PM on March 17, 2015: contributor

    @sipa I believe there should be a code, in case RPC users want to catch the error without having to match the text. Any convention for numbering or could I choose any arbitrary code? (0x60 perhaps)

  5. sipa commented at 1:14 PM on March 17, 2015: member

    Well you can't pick anything that could potentially be later used in the P2P protocol, which why I would prefer no actual code. If there really is a need for RPC error codes separately from what the peer to peer protocol does, perhaps there should just be two codes. In general, I think it's not possible to predict all possible reason for rejecting things, and not really viable to have codes for everything.

  6. shaulkf commented at 1:42 PM on March 17, 2015: contributor

    I'm not sure what you mean by adding REJECT_LOCAL, should I create an error code which will be overloaded for any local error? How about REJECT_LOCAL = 0x00.

  7. shaulkf force-pushed on Mar 17, 2015
  8. laanwj commented at 8:11 AM on March 18, 2015: member

    You could use reject codes > 0x100 for local-only conditions. These cannot be passed over the P2P network.

  9. laanwj added the label RPC on Mar 18, 2015
  10. shaulkf commented at 6:49 PM on March 18, 2015: contributor

    @laanwj Is it okay to change reject message codes to unsigned int for this purpose? If not, please advise is we can assign a dedicated 2 byte code (e.g. 0x00 or 0xFF) for all REJECT_LOCAL errors. I prefer the first solution as RPC users can catch errors with explicit error codes.

  11. laanwj commented at 4:41 PM on March 24, 2015: member

    @shaulkf Changing the internal type is fine with me, otherwise I wouldn't have suggested it. But be careful that you don't accidentally change the type that is sent in the protocol.

  12. laanwj commented at 7:07 AM on April 8, 2015: member

    utACK

  13. luke-jr commented at 5:00 AM on June 24, 2015: member

    Needs rebase. I suggest leaving the const reject message codes (now in consensus/validation.h) as unsigned char, changing CValidationState as you already do, and putting the local codes in main.h (for now).

  14. luke-jr commented at 5:27 AM on June 24, 2015: member

    Also:

    main.cpp: In function ‘void InvalidBlockFound(CBlockIndex*, const CValidationState&)’:
    main.cpp:1369:56: warning: narrowing conversion of ‘(& state)->CValidationState::GetRejectCode()’ from ‘unsigned int’ to ‘unsigned char’ inside { } is ill-formed in C++11 [-Wnarrowing]
                 CBlockReject reject = {state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
                                                            ^
    
  15. paveljanik commented at 9:59 PM on June 26, 2015: contributor

    Needs rebase. I'd prefer to have something in really soon. RPC returns no clean error message and it is boring to look up the actual error in the debug log.

  16. shaulkf force-pushed on Jun 26, 2015
  17. shaulkf commented at 10:51 PM on June 26, 2015: contributor

    Rebased and changed according to @luke-jr's recommendation

  18. shaulkf force-pushed on Jun 30, 2015
  19. shaulkf commented at 5:20 PM on June 30, 2015: contributor

    Thanks @paveljanik, pushed a fix and rebased, this is a remnant from a change I ended up reverting. I agree regarding Invalid and DoS but this should be in a separate PR as it requires reordering the arguments.

  20. Add absurdly high fee message to validation state (for RPC propagation) a651403e09
  21. shaulkf force-pushed on Jun 30, 2015
  22. luke-jr commented at 6:12 AM on July 2, 2015: member

    @shaulkf Please fix the warning.

  23. paveljanik commented at 6:33 AM on July 2, 2015: contributor

    Something like this needed?

    diff --git a/src/main.cpp b/src/main.cpp
    index f67f1fd..5229f6f 100644
    --- a/src/main.cpp
    +++ b/src/main.cpp
    @@ -182,7 +182,7 @@ namespace {
     namespace {
    
     struct CBlockReject {
    -    unsigned char chRejectCode;
    +    unsigned int chRejectCode;
         string strRejectReason;
         uint256 hashBlock;
     };
    
  24. luke-jr commented at 6:36 AM on July 2, 2015: member

    Not sure, that might change the protocol. Maybe:

    CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
    
  25. paveljanik commented at 6:42 AM on July 2, 2015: contributor

    Right.

  26. paveljanik cross-referenced this on Jul 2, 2015 from issue Add OP_RETURN support in createrawtransaction RPC call, add tests. by paveljanik
  27. laanwj commented at 4:40 PM on August 5, 2015: member

    Need this for #6519

  28. sipa commented at 4:51 PM on August 5, 2015: member

    utACK.

    Maybe this also needs an assert before sending out a reject message that the chRejectCode is in the right range.

  29. laanwj commented at 4:53 PM on August 5, 2015: member

    Yes, good point. I'll add it during merge.

  30. laanwj merged this on Aug 5, 2015
  31. laanwj closed this on Aug 5, 2015

  32. laanwj referenced this in commit a0625b8085 on Aug 5, 2015
  33. in src/main.h:None in a651403e09
     496 | @@ -497,4 +497,7 @@ extern CBlockTreeDB *pblocktree;
     497 |   */
     498 |  int GetSpendHeight(const CCoinsViewCache& inputs);
     499 |  
     500 | +/** local "reject" message codes for RPC which can not be triggered by p2p trasactions */
    


    Diapolo commented at 6:45 AM on August 6, 2015:

    Nit: Spelling error trasactions. See https://github.com/theuni/bitcoin/pull/48 @theuni Will there be a Trivial pull before 0.11?

  34. laanwj referenced this in commit 9fc6ed6003 on Dec 7, 2015
  35. laanwj cross-referenced this on Dec 7, 2015 from issue net: Fix sent reject messages for blocks and transactions by laanwj
  36. laanwj referenced this in commit 44fef99e66 on Dec 10, 2015
  37. str4d cross-referenced this on Jul 14, 2017 from issue Bitcoin 0.12 P2P/Net PRs 1 by str4d
  38. str4d cross-referenced this on Apr 5, 2018 from issue Closes #3110. Ensure user can see error message about absurdly high fees. by bitcartel
  39. dagurval cross-referenced this on Sep 10, 2018 from issue Add absurdly high fee message to validation state by dagurval
  40. random-zebra cross-referenced this on Jun 9, 2020 from issue [Refactoring] CValidationState logging by random-zebra
  41. furszy referenced this in commit 8d7e7808d0 on Jun 20, 2020
  42. str4d cross-referenced this on Aug 13, 2021 from issue ZIP 239 preparations 4 by str4d
  43. zkbot referenced this in commit 19a8c45f42 on Aug 13, 2021
  44. zkbot referenced this in commit 8e9f44cbe2 on Aug 13, 2021
  45. zkbot referenced this in commit cf9a0799b4 on Aug 17, 2021
  46. bitcoin locked this on Sep 8, 2021

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-05-20 06:55 UTC