test: Set correct nValue for multi-op-return policy check #20760

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2012-testNValue changing 1 files +2 −0
  1. MarcoFalke commented at 12:48 pm on December 24, 2020: member

    CTxOut::nValue is default-initialized to -1. The dust-threshold for OP_RETURN outputs is 0. Thus, the policy failure would be dust instead of multi-op-return. The test only passes because the dust check is currently not run.

    Avoid that confusion by setting the value to 0, to ensure the dust check passes.

  2. test: Set correct nValue for multi-op-return policy check fad140e311
  3. fanquake added the label Tests on Dec 24, 2020
  4. benthecarman commented at 8:22 am on December 25, 2020: contributor
    Should the dust check be added to this check?
  5. theStack approved
  6. theStack commented at 8:42 pm on December 27, 2020: member

    The dust-threshold for OP_RETURN outputs is 0.

    IMHO the concept of dust makes sense only for outputs that are part of the UTXO set. For provably unspendable outputs, “dust threshold” seems like a misnomer, as any threshold above zero would effectively be an enforcement to burn coins. I think it would be conceptually wrong questionable if GetDustThreshold was ever called for NULL_DATA or any other provably unspendable outputs (even though it includes the sanity check for IsUnspendable() and returns 0 in this case). If there is ever a minimum nAmount introduced for OP_RETURN outputs, it should be called differently than ‘dust limit’.

    That said, I still think the PR itself is an improvement w.r.t. readability and avoiding confusion. (Generally I think scriptPubKey and nValue should always be initialized together). ACK fad140e311028f904635126e3c77352afac1b75e

  7. MarcoFalke commented at 6:33 pm on December 28, 2020: member

    If there is ever a minimum nAmount introduced for OP_RETURN outputs, it should be called differently than ‘dust limit’.

    Agree. Though, I think that GetDustThreshold should be defined and callable for all scriptPubKeys, not only spendable ones. This is also what the current function does. In any case the discussion is theoretical, as only test code is affected.

  8. luke-jr approved
  9. luke-jr commented at 1:20 am on January 3, 2021: member
    utACK
  10. MarcoFalke merged this on Jan 3, 2021
  11. MarcoFalke closed this on Jan 3, 2021

  12. MarcoFalke deleted the branch on Jan 3, 2021
  13. sidhujag referenced this in commit 06b190cc6c on Jan 3, 2021
  14. PastaPastaPasta referenced this in commit 9a01bb32fe on Apr 25, 2022
  15. DrahtBot locked this on Aug 16, 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-11-21 15:12 UTC

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