@@ -955,6 +955,33 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
955
955
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
956
956
BOOST_CHECK_EQUAL (reason, " bare-multisig" );
957
957
fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
958
+
959
+ // Check P2WPKH outputs dust threshold
960
+ t.vout [0 ].scriptPubKey = CScript () << OP_0 << ParseHex (" ffffffffffffffffffffffffffffffffffffffff" );
961
+ t.vout [0 ].nValue = 294 ;
962
+ BOOST_CHECK (IsStandardTx (CTransaction (t), reason));
963
+ t.vout [0 ].nValue = 293 ;
964
+ BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
965
+ BOOST_CHECK_EQUAL (reason, " dust" );
966
+
967
+ // Check P2WSH outputs dust threshold
968
+ t.vout [0 ].scriptPubKey = CScript () << OP_0 << ParseHex (" ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
969
+ t.vout [0 ].nValue = 330 ;
970
+ BOOST_CHECK (IsStandardTx (CTransaction (t), reason));
971
+ t.vout [0 ].nValue = 329 ;
972
+ BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
973
+ BOOST_CHECK_EQUAL (reason, " dust" );
974
+
975
+ // Check future Witness Program versions dust threshold
976
+ for (int op = OP_2; op <= OP_16; op += 1 ) {
977
+ t.vout [0 ].scriptPubKey = CScript () << (opcodetype)op << ParseHex (" ffff" );
978
+ t.vout [0 ].nValue = 240 ;
979
+ BOOST_CHECK (IsStandardTx (CTransaction (t), reason));
980
+
981
+ t.vout [0 ].nValue = 239 ;
982
+ BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
983
+ BOOST_CHECK_EQUAL (reason, " dust" );
984
+ }
958
985
}
959
986
960
987
BOOST_AUTO_TEST_SUITE_END ()
0 commit comments