Skip to content

Commit

Permalink
Disable accumulator loading
Browse files Browse the repository at this point in the history
  • Loading branch information
celbalrai authored and ckti committed Apr 10, 2022
1 parent 44ef94a commit 43b9194
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
8 changes: 0 additions & 8 deletions src/txdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
20 changes: 0 additions & 20 deletions src/zwgr/accumulators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion src/zwgr/accumulators.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 43b9194

Please sign in to comment.