Only check for a valid Sapling anchor after Sapling activation.

Before Sapling activates, hashFinalSaplingRoot is 0x0, which is
not a valid anchor.  After Sapling activates, the empty root value
of 0x3e49... is a valid anchor.
This commit is contained in:
Simon
2018-07-25 12:26:47 -07:00
parent 3a5f66c880
commit d9fe33b86f

View File

@@ -1986,7 +1986,9 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
// state on the path to the tip of our chain
assert(pcoinsTip->GetSproutAnchorAt(pindex->hashSproutAnchor, sproutTree));
if (pindex->pprev) {
assert(pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree));
if (NetworkUpgradeActive(pindex->pprev->nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
assert(pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree));
}
}
// Increment note witness caches
IncrementNoteWitnesses(pindex, &block, sproutTree, saplingTree);