|
|
@ -342,11 +342,26 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) |
|
|
|
string reason; |
|
|
|
string reason; |
|
|
|
BOOST_CHECK(IsStandardTx(t, reason)); |
|
|
|
BOOST_CHECK(IsStandardTx(t, reason)); |
|
|
|
|
|
|
|
|
|
|
|
t.vout[0].nValue = 501; // dust
|
|
|
|
// Check dust with default relay fee:
|
|
|
|
|
|
|
|
CAmount nDustThreshold = 182 * minRelayTxFee.GetFeePerK()/1000 * 3; |
|
|
|
|
|
|
|
BOOST_CHECK_EQUAL(nDustThreshold, 546); |
|
|
|
|
|
|
|
// dust:
|
|
|
|
|
|
|
|
t.vout[0].nValue = nDustThreshold - 1; |
|
|
|
BOOST_CHECK(!IsStandardTx(t, reason)); |
|
|
|
BOOST_CHECK(!IsStandardTx(t, reason)); |
|
|
|
|
|
|
|
// not dust:
|
|
|
|
|
|
|
|
t.vout[0].nValue = nDustThreshold; |
|
|
|
|
|
|
|
BOOST_CHECK(IsStandardTx(t, reason)); |
|
|
|
|
|
|
|
|
|
|
|
t.vout[0].nValue = 2730; // not dust
|
|
|
|
// Check dust with odd relay fee to verify rounding:
|
|
|
|
|
|
|
|
// nDustThreshold = 182 * 1234 / 1000 * 3
|
|
|
|
|
|
|
|
minRelayTxFee = CFeeRate(1234); |
|
|
|
|
|
|
|
// dust:
|
|
|
|
|
|
|
|
t.vout[0].nValue = 672 - 1; |
|
|
|
|
|
|
|
BOOST_CHECK(!IsStandardTx(t, reason)); |
|
|
|
|
|
|
|
// not dust:
|
|
|
|
|
|
|
|
t.vout[0].nValue = 672; |
|
|
|
BOOST_CHECK(IsStandardTx(t, reason)); |
|
|
|
BOOST_CHECK(IsStandardTx(t, reason)); |
|
|
|
|
|
|
|
minRelayTxFee = CFeeRate(1000); |
|
|
|
|
|
|
|
|
|
|
|
t.vout[0].scriptPubKey = CScript() << OP_1; |
|
|
|
t.vout[0].scriptPubKey = CScript() << OP_1; |
|
|
|
BOOST_CHECK(!IsStandardTx(t, reason)); |
|
|
|
BOOST_CHECK(!IsStandardTx(t, reason)); |
|
|
|