@@ -706,7 +706,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
706
706
BOOST_CHECK_EQUAL (nDustThreshold, 546 );
707
707
// dust:
708
708
t.vout [0 ].nValue = nDustThreshold - 1 ;
709
+ reason.clear ();
709
710
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
711
+ BOOST_CHECK_EQUAL (reason, " dust" );
710
712
// not dust:
711
713
t.vout [0 ].nValue = nDustThreshold;
712
714
BOOST_CHECK (IsStandardTx (CTransaction (t), reason));
@@ -716,14 +718,18 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
716
718
dustRelayFee = CFeeRate (3702 );
717
719
// dust:
718
720
t.vout [0 ].nValue = 673 - 1 ;
721
+ reason.clear ();
719
722
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
723
+ BOOST_CHECK_EQUAL (reason, " dust" );
720
724
// not dust:
721
725
t.vout [0 ].nValue = 673 ;
722
726
BOOST_CHECK (IsStandardTx (CTransaction (t), reason));
723
727
dustRelayFee = CFeeRate (DUST_RELAY_TX_FEE);
724
728
725
729
t.vout [0 ].scriptPubKey = CScript () << OP_1;
730
+ reason.clear ();
726
731
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
732
+ BOOST_CHECK_EQUAL (reason, " scriptpubkey" );
727
733
728
734
// MAX_OP_RETURN_RELAY-byte TX_NULL_DATA (standard)
729
735
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38" );
@@ -733,7 +739,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
733
739
// MAX_OP_RETURN_RELAY+1-byte TX_NULL_DATA (non-standard)
734
740
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3800" );
735
741
BOOST_CHECK_EQUAL (MAX_OP_RETURN_RELAY + 1 , t.vout [0 ].scriptPubKey .size ());
742
+ reason.clear ();
736
743
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
744
+ BOOST_CHECK_EQUAL (reason, " scriptpubkey" );
737
745
738
746
// Data payload can be encoded in any way...
739
747
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" " );
@@ -748,7 +756,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
748
756
749
757
// ...so long as it only contains PUSHDATA's
750
758
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << OP_RETURN;
759
+ reason.clear ();
751
760
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
761
+ BOOST_CHECK_EQUAL (reason, " scriptpubkey" );
752
762
753
763
// TX_NULL_DATA w/o PUSHDATA
754
764
t.vout .resize (1 );
@@ -759,15 +769,21 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
759
769
t.vout .resize (2 );
760
770
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38" );
761
771
t.vout [1 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38" );
772
+ reason.clear ();
762
773
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
774
+ BOOST_CHECK_EQUAL (reason, " multi-op-return" );
763
775
764
776
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38" );
765
777
t.vout [1 ].scriptPubKey = CScript () << OP_RETURN;
778
+ reason.clear ();
766
779
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
780
+ BOOST_CHECK_EQUAL (reason, " multi-op-return" );
767
781
768
782
t.vout [0 ].scriptPubKey = CScript () << OP_RETURN;
769
783
t.vout [1 ].scriptPubKey = CScript () << OP_RETURN;
784
+ reason.clear ();
770
785
BOOST_CHECK (!IsStandardTx (CTransaction (t), reason));
786
+ BOOST_CHECK_EQUAL (reason, " multi-op-return" );
771
787
}
772
788
773
789
BOOST_AUTO_TEST_SUITE_END ()
0 commit comments