From 46e453b8bc71645de706a64dbd196ebce5a7db80 Mon Sep 17 00:00:00 2001 From: furszy Date: Thu, 16 May 2019 20:24:11 +0200 Subject: [PATCH] [zPIV] reject priv coin spends on tx mempool acceptance. --- src/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 69f50ca0841d0..0f0256238b2b8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1409,11 +1409,18 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransa for (const CTxIn& txIn : tx.vin) { // Only allow for zc spends inputs bool isPublicSpend = txIn.IsZerocoinPublicSpend(); - if (!txIn.IsZerocoinSpend() && !isPublicSpend) { - return state.Invalid(error("%s: ContextualCheckZerocoinSpend failed for tx %s, every input must be a zcspend or zcpublicspend", __func__, + bool isPrivZerocoinSpend = txIn.IsZerocoinSpend(); + if (!isPrivZerocoinSpend && !isPublicSpend) { + return state.Invalid(error("%s: AcceptToMemoryPool failed for tx %s, every input must be a zcspend or zcpublicspend", __func__, tx.GetHash().GetHex()), REJECT_INVALID, "bad-txns-invalid-zpiv"); } + // Check enforcement + if (!CheckPublicCoinSpendEnforced(chainActive.Height(), isPrivZerocoinSpend, isPublicSpend)){ + return state.Invalid(error("%s: AcceptToMemoryPool failed for tx %s", __func__, + tx.GetHash().GetHex()), REJECT_INVALID, "bad-txns-invalid-zpiv"); + } + if (isPublicSpend) { libzerocoin::ZerocoinParams* params = Params().Zerocoin_Params(false); PublicCoinSpend publicSpend(params);