bitcoin-tx: validate range of parsed output amount #22193

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202106-bitcoin-tx-validate_money_range changing 1 files +2 −0
  1. theStack commented at 11:31 pm on June 8, 2021: member

    This tiny PR adds a sanity check to the bitcoin-tx tool w.r.t. to tx output values specified by the user: the parsing function ExtractAndValidateValue is extended to throw if the amount is not in range [0, MAX_MONEY].

    master:

    0$ bitcoin-tx -create outdata=21000001:affe
    10200000000010021fd5ff0750700046a02affe00000000
    

    PR branch:

    0$ bitcoin-tx -create outdata=21000001:affe
    1error: TX output value out of range
    
  2. bitcoin-tx: validate range of parsed output amount b6448c70dc
  3. meshcollider added the label Utils/log/libs on Jun 9, 2021
  4. practicalswift commented at 12:30 pm on June 9, 2021: contributor

    Concept ACK

    Non-blocking thought: I guess it could be argued that bool ParseMoney(const std::string& str, CAmount& nRet) should return false if !MoneyRange(nRet).

    Can we see a use case for ParseMoney where it shouldn’t be immediately followed by a MoneyRange check?

  5. MarcoFalke commented at 8:13 am on June 10, 2021: member

    Agree with @practicalswift that neither fees nor fee rates larger than MAX_MONEY make any sense.

    See also:

    Finally, ParseMoney could be changed to return std::optional<CAmount>.

  6. DrahtBot commented at 3:48 pm on June 11, 2021: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. theStack commented at 12:15 pm on August 3, 2021: member
    PR #22220 includes putting the MoneyRange check into ParseMoney, so this PR can be closed.
  8. theStack closed this on Aug 3, 2021

  9. fanquake referenced this in commit 61a843e43b on Aug 24, 2021
  10. sidhujag referenced this in commit ba83c0e35f on Aug 24, 2021
  11. DrahtBot locked this on Aug 18, 2022

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: 2024-12-18 18:12 UTC

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