Skip to content

Commit

Permalink
[zPIV] reject priv coin spends on tx mempool acceptance.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jun 4, 2019
1 parent afdb9d4 commit 46e453b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 46e453b

Please sign in to comment.