Skip to content

Commit

Permalink
[BUG] Remove spork-based CheckPublicCoinSpendVersion
Browse files Browse the repository at this point in the history
as this was meant to be checked only if IsBlockChainSynced.
As zerocoin public spends are no longer accepted (both in
main-net/testnet) we can just remove it.
  • Loading branch information
random-zebra committed Jul 25, 2021
1 parent 10db9bf commit 78a5da8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 1 addition & 10 deletions src/consensus/zerocoin_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ bool CheckPublicCoinSpendEnforced(int blockHeight, bool isPublicSpend)
return true;
}

int CurrentPublicCoinSpendVersion() {
return sporkManager.IsSporkActive(SPORK_18_ZEROCOIN_PUBLICSPEND_V4) ? 4 : 3;
}

bool CheckPublicCoinSpendVersion(int version) {
return version == CurrentPublicCoinSpendVersion();
}

bool ContextualCheckZerocoinTx(const CTransactionRef& tx, CValidationState& state, const Consensus::Params& consensus, int nHeight)
{
// zerocoin enforced via block time. First block with a zc mint is 863735
Expand Down Expand Up @@ -269,8 +261,7 @@ Optional<CoinSpendValues> ParseAndValidateZerocoinSpends(const Consensus::Params
if (isPublicSpend) {
libzerocoin::ZerocoinParams* params = consensus.Zerocoin_Params(false);
PublicCoinSpend publicSpend(params);
if (!ZPIVModule::ParseZerocoinPublicSpend(txIn, tx, state, publicSpend) ||
!CheckPublicCoinSpendVersion(publicSpend.getCoinVersion())) {
if (!ZPIVModule::ParseZerocoinPublicSpend(txIn, tx, state, publicSpend)) {
return nullopt;
}
//queue for db write after the 'justcheck' section has concluded
Expand Down
2 changes: 0 additions & 2 deletions src/consensus/zerocoin_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
bool isBlockBetweenFakeSerialAttackRange(int nHeight);
// Public coin spend
bool CheckPublicCoinSpendEnforced(int blockHeight, bool isPublicSpend);
int CurrentPublicCoinSpendVersion();
bool CheckPublicCoinSpendVersion(int version);
bool ContextualCheckZerocoinTx(const CTransactionRef& tx, CValidationState& state, const Consensus::Params& consensus, int nHeight);
bool ContextualCheckZerocoinSpend(const CTransaction& tx, const libzerocoin::CoinSpend* spend, int nHeight);
bool ContextualCheckZerocoinSpendNoSerialCheck(const CTransaction& tx, const libzerocoin::CoinSpend* spend, int nHeight);
Expand Down

0 comments on commit 78a5da8

Please sign in to comment.