Skip to content

Commit

Permalink
Reject zerocoin transactions before tx checks
Browse files Browse the repository at this point in the history
  • Loading branch information
celbalrai authored and wagerr-builder committed Jun 17, 2022
1 parent 83f8469 commit 9e75bca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,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

Expand Down Expand Up @@ -2223,6 +2228,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)) {
Expand All @@ -2245,6 +2251,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))
Expand Down

0 comments on commit 9e75bca

Please sign in to comment.