Skip to content

Commit

Permalink
Merge bitcoin#20760: test: Set correct nValue for multi-op-return pol…
Browse files Browse the repository at this point in the history
…icy check

fad140e test: Set correct nValue for multi-op-return policy check (MarcoFalke)

Pull request description:

  `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.

ACKs for top commit:
  theStack:
    ACK fad140e

Tree-SHA512: f0c7a68eb2c573d6595b2b129fa8fa2a34fa35c17691f448bf1c54ccf66059c37562e7480cde7b51c4de677038d7717873da4257147a5f60acc8bbcd25fb7e3f
  • Loading branch information
MarcoFalke authored and PastaPastaPasta committed Apr 25, 2022
1 parent 49e8ca6 commit 9a01bb3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// Only one TX_NULL_DATA permitted in all cases
t.vout.resize(2);
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
t.vout[0].nValue = 0;
t.vout[1].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
t.vout[1].nValue = 0;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "multi-op-return");
Expand Down

0 comments on commit 9a01bb3

Please sign in to comment.