Skip to content

Commit 964ca46

Browse files
celbalraiwagerr-builder
authored andcommitted
Reject zerocoin transactions before tx checks
1 parent 346d06b commit 964ca46

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/validation.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,11 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
673673
*pfMissingInputs = false;
674674
}
675675

676+
bool fV17Active_context = (unsigned int)chainActive.Height() >= Params().GetConsensus().V17DeploymentHeight;
677+
if (fV17Active_context && tx.ContainsZerocoins()) {
678+
return state.DoS(30, error("%s: zerocoin has been disabled", __func__), REJECT_INVALID, "bad-txns-xwagerr");
679+
}
680+
676681
if (!CheckTransaction(tx, state, true))
677682
return false; // state filled in by CheckTransaction
678683

@@ -696,7 +701,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
696701
// This ensures that someone won't create an invalid OP_GROUP tx that sits in the mempool until after activation,
697702
// potentially causing this node to create a bad block.
698703
if (IsAnyOutputGrouped(tx)) {
699-
if ((unsigned int)chainActive.Tip()->nHeight < chainparams.GetConsensus().ATPStartHeight)
704+
if ((unsigned int)chainActive.Height() < chainparams.GetConsensus().ATPStartHeight)
700705
{
701706
return state.DoS(0, false, REJECT_NONSTANDARD, "premature-op_group-tx");
702707
} else if (!IsAnyOutputGroupedCreation(tx, TokenGroupIdFlags::MGT_TOKEN) && !tokenGroupManager.get()->ManagementTokensCreated()){
@@ -2244,6 +2249,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
22442249
txdata.reserve(block.vtx.size()); // Required so that pointers to individual PrecomputedTransactionData don't get invalidated
22452250

22462251
bool fDIP0001Active_context = pindex->nHeight >= Params().GetConsensus().DIP0001Height;
2252+
bool fV17Active_context = pindex->nHeight >= Params().GetConsensus().V17DeploymentHeight;
22472253

22482254
// MUST process special txes before updating UTXO to ensure consistency between mempool and block processing
22492255
if (!ProcessSpecialTxsInBlock(block, pindex, state, view, fJustCheck, fScriptChecks)) {
@@ -2266,6 +2272,10 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
22662272

22672273
nInputs += tx->vin.size();
22682274

2275+
if (fV17Active_context && tx->ContainsZerocoins()) {
2276+
return state.DoS(100, error("%s: zerocoin has been disabled", __func__), REJECT_INVALID, "bad-txns-xwagerr");
2277+
}
2278+
22692279
if (tx->HasZerocoinSpendInputs())
22702280
{
22712281
if (!CheckZerocoinSpendTx(pindex, state, *tx, vSpendsInBlock, vSpends, vMints, nValueIn))

0 commit comments

Comments
 (0)