From 43b9194d83e7fff4f308562830cae18604d91273 Mon Sep 17 00:00:00 2001 From: celbalrai <80897309+celbalrai@users.noreply.github.com> Date: Sun, 18 Apr 2021 08:01:54 +0200 Subject: [PATCH] Disable accumulator loading --- src/txdb.cpp | 8 -------- src/zwgr/accumulators.cpp | 20 -------------------- src/zwgr/accumulators.h | 1 - 3 files changed, 29 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index d5e7a80aa5537b..99d204819aa9fc 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -461,14 +461,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, if (!IsProofOfStakeHeight(pindexNew->nHeight, consensusParams) && pindexNew->IsProofOfWork() && !CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams)) return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString()); - //populate accumulator checksum map in memory - if(pindexNew->nAccumulatorCheckpoint != uint256() && pindexNew->nAccumulatorCheckpoint != nPreviousCheckpoint) { - //Don't load any checkpoints that exist before v2 zwgr. The accumulator is invalid for v1 and not used. - if (pindexNew->nHeight >= Params().GetConsensus().nBlockZerocoinV2) - LoadAccumulatorValuesFromDB(pindexNew->nAccumulatorCheckpoint); - - nPreviousCheckpoint = pindexNew->nAccumulatorCheckpoint; - } pcursor->Next(); } else { return error("%s: failed to read value", __func__); diff --git a/src/zwgr/accumulators.cpp b/src/zwgr/accumulators.cpp index 1af630a15ddbf1..c910dff69d02de 100644 --- a/src/zwgr/accumulators.cpp +++ b/src/zwgr/accumulators.cpp @@ -137,26 +137,6 @@ bool EraseAccumulatorValues(const uint256& nCheckpointErase, const uint256& nChe return true; } - -bool LoadAccumulatorValuesFromDB(const uint256 nCheckpoint) -{ - for (auto& denomination : libzerocoin::zerocoinDenomList) { - uint32_t nChecksum = ParseChecksum(nCheckpoint, denomination); - - //if read is not successful then we are not in a state to verify zerocoin transactions - CBigNum bnValue; - if (!zerocoinDB->ReadAccumulatorValue(nChecksum, bnValue)) { - if (!count(listAccCheckpointsNoDB.begin(), listAccCheckpointsNoDB.end(), nCheckpoint)) - listAccCheckpointsNoDB.push_back(nCheckpoint); - LogPrint(BCLog::ZEROCOIN, "%s : Missing databased value for checksum %d\n", __func__, nChecksum); - return false; - } - mapAccumulatorValues.insert(std::make_pair(nChecksum, bnValue)); - } - return true; -} - - //Erase accumulator checkpoints for a certain block range bool EraseCheckpoints(int nStartHeight, int nEndHeight) { diff --git a/src/zwgr/accumulators.h b/src/zwgr/accumulators.h index fc0d894c51840d..d2ded253fce1e9 100644 --- a/src/zwgr/accumulators.h +++ b/src/zwgr/accumulators.h @@ -58,7 +58,6 @@ void AddAccumulatorChecksum(const uint32_t nChecksum, const CBigNum &bnValue, bo bool CalculateAccumulatorCheckpoint(int nHeight, uint256& nCheckpoint, AccumulatorMap& mapAccumulators); bool CalculateAccumulatorCheckpointWithoutDB(int nHeight, uint256& nCheckpoint, AccumulatorMap& mapAccumulators); void DatabaseChecksums(AccumulatorMap& mapAccumulators); -bool LoadAccumulatorValuesFromDB(const uint256 nCheckpoint); bool EraseAccumulatorValues(const uint256& nCheckpointErase, const uint256& nCheckpointPrevious); uint32_t ParseChecksum(uint256 nChecksum, libzerocoin::CoinDenomination denomination); uint32_t GetChecksum(const CBigNum &bnValue);