diff --git a/src/validation.cpp b/src/validation.cpp index 908896a0acef2..593db09221914 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -673,6 +673,11 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool *pfMissingInputs = false; } + bool fV17Active_context = (unsigned int)chainActive.Height() >= Params().GetConsensus().V17DeploymentHeight; + if (fV17Active_context && tx.ContainsZerocoins()) { + return state.DoS(30, error("%s: zerocoin has been disabled", __func__), REJECT_INVALID, "bad-txns-xwagerr"); + } + if (!CheckTransaction(tx, state, true)) return false; // state filled in by CheckTransaction @@ -696,7 +701,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool // This ensures that someone won't create an invalid OP_GROUP tx that sits in the mempool until after activation, // potentially causing this node to create a bad block. if (IsAnyOutputGrouped(tx)) { - if ((unsigned int)chainActive.Tip()->nHeight < chainparams.GetConsensus().ATPStartHeight) + if ((unsigned int)chainActive.Height() < chainparams.GetConsensus().ATPStartHeight) { return state.DoS(0, false, REJECT_NONSTANDARD, "premature-op_group-tx"); } else if (!IsAnyOutputGroupedCreation(tx, TokenGroupIdFlags::MGT_TOKEN) && !tokenGroupManager.get()->ManagementTokensCreated()){ @@ -2244,6 +2249,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl txdata.reserve(block.vtx.size()); // Required so that pointers to individual PrecomputedTransactionData don't get invalidated bool fDIP0001Active_context = pindex->nHeight >= Params().GetConsensus().DIP0001Height; + bool fV17Active_context = pindex->nHeight >= Params().GetConsensus().V17DeploymentHeight; // MUST process special txes before updating UTXO to ensure consistency between mempool and block processing if (!ProcessSpecialTxsInBlock(block, pindex, state, view, fJustCheck, fScriptChecks)) { @@ -2266,6 +2272,10 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl nInputs += tx->vin.size(); + if (fV17Active_context && tx->ContainsZerocoins()) { + return state.DoS(100, error("%s: zerocoin has been disabled", __func__), REJECT_INVALID, "bad-txns-xwagerr"); + } + if (tx->HasZerocoinSpendInputs()) { if (!CheckZerocoinSpendTx(pindex, state, *tx, vSpendsInBlock, vSpends, vMints, nValueIn))