Skip to content

Commit

Permalink
unit test: adapt to changing MAX_DUST_OUTPUTS_PER_TX
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Nov 20, 2024
1 parent 7c34901 commit ca050d1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,11 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
CAmount nDustThreshold = 182 * g_dust.GetFeePerK() / 1000;
BOOST_CHECK_EQUAL(nDustThreshold, 546);

// Add dust output to take dust slot, still standard!
t.vout.emplace_back(0, t.vout[0].scriptPubKey);
CheckIsStandard(t);
// Add dust outputs up to allowed maximum, still standard!
for (size_t i{0}; i < MAX_DUST_OUTPUTS_PER_TX; ++i) {
t.vout.emplace_back(0, t.vout[0].scriptPubKey);
CheckIsStandard(t);
}

// dust:
t.vout[0].nValue = nDustThreshold - 1;
Expand Down Expand Up @@ -974,9 +976,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
CheckIsNotStandard(t, "bare-multisig");
g_bare_multi = DEFAULT_PERMIT_BAREMULTISIG;

// Add dust output to take dust slot
// Add dust outputs up to allowed maximum
assert(t.vout.size() == 1);
t.vout.emplace_back(0, t.vout[0].scriptPubKey);
t.vout.insert(t.vout.end(), MAX_DUST_OUTPUTS_PER_TX, {0, t.vout[0].scriptPubKey});

// Check compressed P2PK outputs dust threshold (must have leading 02 or 03)
t.vout[0].scriptPubKey = CScript() << std::vector<unsigned char>(33, 0x02) << OP_CHECKSIG;
Expand Down

0 comments on commit ca050d1

Please sign in to comment.