From d9fe33b86f651a82c2634f99b82f4b6c95410d35 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 25 Jul 2018 12:26:47 -0700 Subject: [PATCH] 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. --- src/wallet/wallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index efec41780..7172ea40c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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);