Skip to content

Commit ca050d1

Browse files
committed
unit test: adapt to changing MAX_DUST_OUTPUTS_PER_TX
1 parent 7c34901 commit ca050d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/test/transaction_tests.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,11 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
814814
CAmount nDustThreshold = 182 * g_dust.GetFeePerK() / 1000;
815815
BOOST_CHECK_EQUAL(nDustThreshold, 546);
816816

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

821823
// dust:
822824
t.vout[0].nValue = nDustThreshold - 1;
@@ -974,9 +976,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
974976
CheckIsNotStandard(t, "bare-multisig");
975977
g_bare_multi = DEFAULT_PERMIT_BAREMULTISIG;
976978

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

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

0 commit comments

Comments
 (0)