Skip to content

Commit 46e453b

Browse files
committed
[zPIV] reject priv coin spends on tx mempool acceptance.
1 parent afdb9d4 commit 46e453b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,11 +1409,18 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransa
14091409
for (const CTxIn& txIn : tx.vin) {
14101410
// Only allow for zc spends inputs
14111411
bool isPublicSpend = txIn.IsZerocoinPublicSpend();
1412-
if (!txIn.IsZerocoinSpend() && !isPublicSpend) {
1413-
return state.Invalid(error("%s: ContextualCheckZerocoinSpend failed for tx %s, every input must be a zcspend or zcpublicspend", __func__,
1412+
bool isPrivZerocoinSpend = txIn.IsZerocoinSpend();
1413+
if (!isPrivZerocoinSpend && !isPublicSpend) {
1414+
return state.Invalid(error("%s: AcceptToMemoryPool failed for tx %s, every input must be a zcspend or zcpublicspend", __func__,
14141415
tx.GetHash().GetHex()), REJECT_INVALID, "bad-txns-invalid-zpiv");
14151416
}
14161417

1418+
// Check enforcement
1419+
if (!CheckPublicCoinSpendEnforced(chainActive.Height(), isPrivZerocoinSpend, isPublicSpend)){
1420+
return state.Invalid(error("%s: AcceptToMemoryPool failed for tx %s", __func__,
1421+
tx.GetHash().GetHex()), REJECT_INVALID, "bad-txns-invalid-zpiv");
1422+
}
1423+
14171424
if (isPublicSpend) {
14181425
libzerocoin::ZerocoinParams* params = Params().Zerocoin_Params(false);
14191426
PublicCoinSpend publicSpend(params);

0 commit comments

Comments
 (0)