|
|
@ -2235,7 +2235,8 @@ enum DisconnectResult |
|
|
|
* The addressIndex and spentIndex will be updated if requested. |
|
|
|
*/ |
|
|
|
static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& state, |
|
|
|
const CBlockIndex* pindex, CCoinsViewCache& view, bool const updateIndices) |
|
|
|
const CBlockIndex* pindex, CCoinsViewCache& view, const CChainParams& chainparams, |
|
|
|
const bool updateIndices) |
|
|
|
{ |
|
|
|
assert(pindex->GetBlockHash() == view.GetBestBlock()); |
|
|
|
|
|
|
@ -2361,7 +2362,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s |
|
|
|
// However, this is only reliable if the last block was on or after
|
|
|
|
// the Sapling activation height. Otherwise, the last anchor was the
|
|
|
|
// empty root.
|
|
|
|
if (NetworkUpgradeActive(pindex->pprev->nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) { |
|
|
|
if (NetworkUpgradeActive(pindex->pprev->nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING)) { |
|
|
|
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING); |
|
|
|
} else { |
|
|
|
view.PopAnchor(SaplingMerkleTree::empty_root(), SAPLING); |
|
|
@ -3035,7 +3036,7 @@ bool static DisconnectTip(CValidationState &state, const CChainParams& chainpara |
|
|
|
{ |
|
|
|
CCoinsViewCache view(pcoinsTip); |
|
|
|
// insightexplorer: update indices (true)
|
|
|
|
if (DisconnectBlock(block, state, pindexDelete, view, true) != DISCONNECT_OK) |
|
|
|
if (DisconnectBlock(block, state, pindexDelete, view, chainparams, true) != DISCONNECT_OK) |
|
|
|
return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString()); |
|
|
|
assert(view.Flush()); |
|
|
|
} |
|
|
@ -4492,7 +4493,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, |
|
|
|
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks
|
|
|
|
if (nCheckLevel >= 3 && pindex == pindexState && (coins.DynamicMemoryUsage() + pcoinsTip->DynamicMemoryUsage()) <= nCoinCacheUsage) { |
|
|
|
// insightexplorer: do not update indices (false)
|
|
|
|
DisconnectResult res = DisconnectBlock(block, state, pindex, coins, false); |
|
|
|
DisconnectResult res = DisconnectBlock(block, state, pindex, coins, chainparams, false); |
|
|
|
if (res == DISCONNECT_FAILED) { |
|
|
|
return error("VerifyDB(): *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); |
|
|
|
} |
|
|
|