Tiny refactor of `IsRBFOptIn`, avoid exception #7812

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/04/rbf_refact changing 3 files +19 −16
  1. jonasschnelli commented at 12:43 PM on April 5, 2016: contributor

    While working with RBF in the GUI, the exception in IsRBFOptIn() (throw std::runtime_error("Cannot determine RBF opt-in signal for non-mempool transaction\n")) could be unexpected.

  2. jonasschnelli added the label Refactoring on Apr 5, 2016
  3. MarcoFalke commented at 12:49 PM on April 5, 2016: member

    Concept ACK

  4. sdaftuar commented at 1:02 PM on April 5, 2016: member

    Looks good, thanks for cleaning this up. This code is tested in listtransactions.py, which passes on my machine, so ACK (assuming travis agrees).

  5. in src/wallet/rpcwallet.cpp:None in 1e211e2c56 outdated
      87 | -                rbfStatus = "yes";
      88 | -            } else {
      89 | -                rbfStatus = "unknown";
      90 | -            }
      91 | -        } else if (IsRBFOptIn(*mempool.mapTx.find(hash), mempool)) {
      92 | +        RBFTransactionState rbfState = IsRBFOptIn(wtx, mempool);
    


    sipa commented at 1:03 PM on April 5, 2016:

    Use a switch case?


    jonasschnelli commented at 1:05 PM on April 5, 2016:

    Meh. Had that first, but the if/elseif uses less lines (just two conditions).


    paveljanik commented at 8:37 AM on April 6, 2016:

    In this case, I think '?' operator is the best solution here... Isn't FINAL case missing here anyway?


    jonasschnelli commented at 8:58 AM on April 6, 2016:

    I think the ? operator does not fit well for a non-boolean. The FINAL case is handled by the default value set at L82.

  6. paveljanik commented at 7:12 PM on April 5, 2016: contributor

    Commit message typo: expection -> exception

  7. dcousens commented at 12:23 AM on April 6, 2016: contributor

    utACK 1e211e2

  8. Refactor IsRBFOptIn, avoid exception 4f7c959af1
  9. jonasschnelli force-pushed on Apr 6, 2016
  10. jonasschnelli commented at 9:00 AM on April 6, 2016: contributor

    Force push fixed the git commit message typo.

  11. laanwj merged this on Apr 14, 2016
  12. laanwj closed this on Apr 14, 2016

  13. laanwj referenced this in commit 430fffefaa on Apr 14, 2016
  14. codablock referenced this in commit 0ac854c8d1 on Sep 16, 2017
  15. codablock referenced this in commit 3573434c97 on Sep 19, 2017
  16. codablock referenced this in commit c176f6c5b5 on Dec 20, 2017
  17. MarcoFalke 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-04-22 06:15 UTC

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