@@ -94,25 +94,25 @@ BOOST_FIXTURE_TEST_CASE(test_simple_shielded_invalid, TestingSetup)
9494 }
9595}
9696
97- void CheckBlockZcRejection (std::shared_ptr<CBlock>& pblock, int nHeight, CMutableTransaction& mtx)
97+ void CheckBlockZcRejection (std::shared_ptr<CBlock>& pblock, int nHeight, CMutableTransaction& mtx, const std::string& expected_msg )
9898{
9999 pblock->vtx .emplace_back (MakeTransactionRef (mtx));
100100 BOOST_CHECK (SolveBlock (pblock, nHeight));
101101 BlockStateCatcher stateCatcher (pblock->GetHash ());
102102 stateCatcher.registerEvent ();
103103 BOOST_CHECK (!ProcessNewBlock (pblock, nullptr ));
104104 BOOST_CHECK (stateCatcher.found && !stateCatcher.state .IsValid ());
105- BOOST_CHECK_EQUAL (stateCatcher.state .GetRejectReason (), " bad-blk-with-zc " );
105+ BOOST_CHECK_EQUAL (stateCatcher.state .GetRejectReason (), expected_msg );
106106}
107107
108- void CheckMempoolZcRejection (CMutableTransaction& mtx)
108+ void CheckMempoolZcRejection (CMutableTransaction& mtx, const std::string& expected_msg )
109109{
110110 LOCK (cs_main);
111111 CValidationState state;
112112 BOOST_CHECK (!AcceptToMemoryPool (
113113 mempool, state, MakeTransactionRef (mtx), true , nullptr , false , true ));
114114 BOOST_CHECK (!state.IsValid ());
115- BOOST_CHECK_EQUAL (state.GetRejectReason (), " bad-tx-with-zc " );
115+ BOOST_CHECK_EQUAL (state.GetRejectReason (), expected_msg );
116116}
117117
118118/*
@@ -121,6 +121,7 @@ void CheckMempoolZcRejection(CMutableTransaction& mtx)
121121BOOST_FIXTURE_TEST_CASE (zerocoin_rejection_tests, WalletRegTestingSetup)
122122{
123123 UpdateNetworkUpgradeParameters (Consensus::UPGRADE_V5_0, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
124+ UpdateNetworkUpgradeParameters (Consensus::UPGRADE_ZC_PUBLIC, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
124125 const CChainParams& chainparams = Params ();
125126
126127 std::unique_ptr<CBlockTemplate> pblocktemplate;
@@ -140,21 +141,21 @@ BOOST_FIXTURE_TEST_CASE(zerocoin_rejection_tests, WalletRegTestingSetup)
140141 CBigNum::randBignum (chainparams.GetConsensus ().Zerocoin_Params (false )->coinCommitmentGroup .groupOrder ).getvch ();
141142 mtx.vout [0 ].nValue = 1 * COIN;
142143 std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>(pblocktemplate->block );
143- CheckBlockZcRejection (pblock, 1 , mtx);
144- CheckMempoolZcRejection (mtx);
144+ CheckBlockZcRejection (pblock, 1 , mtx, " bad-txns-zc-mint " );
145+ CheckMempoolZcRejection (mtx, " bad-txns-zc-mint " );
145146
146147 // Zerocoin spends rejection test
147148 mtx.vout [0 ].scriptPubKey = scriptPubKey;
148149 mtx.vin [0 ].scriptSig = CScript () << OP_ZEROCOINSPEND;
149150 pblock = std::make_shared<CBlock>(pblocktemplate->block );
150- CheckBlockZcRejection (pblock, 1 , mtx);
151- CheckMempoolZcRejection (mtx);
151+ CheckBlockZcRejection (pblock, 1 , mtx, " bad-txns-zc-private-spend " );
152+ CheckMempoolZcRejection (mtx, " bad-txns-zc-private-spend " );
152153
153154 // Zerocoin public spends rejection test
154155 mtx.vin [0 ].scriptSig = CScript () << OP_ZEROCOINPUBLICSPEND;
155156 pblock = std::make_shared<CBlock>(pblocktemplate->block );
156- CheckBlockZcRejection (pblock, 1 , mtx);
157- CheckMempoolZcRejection (mtx);
157+ CheckBlockZcRejection (pblock, 1 , mtx, " bad-txns-zc-public-spend " );
158+ CheckMempoolZcRejection (mtx, " bad-txns-zc-public-spend " );
158159}
159160
160161BOOST_AUTO_TEST_SUITE_END ()
0 commit comments