From f791ce00eb132a119c52403a92e2d0cf907dc74c Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Tue, 14 Aug 2018 15:17:30 -0600 Subject: [PATCH] Always write the empty root down as the best root, since we may roll back. --- src/txdb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 36b992a8e..2bed1df47 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -184,9 +184,9 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, if (!hashBlock.IsNull()) batch.Write(DB_BEST_BLOCK, hashBlock); - if (!hashSproutAnchor.IsNull() && hashSproutAnchor != SproutMerkleTree::empty_root()) + if (!hashSproutAnchor.IsNull()) batch.Write(DB_BEST_SPROUT_ANCHOR, hashSproutAnchor); - if (!hashSaplingAnchor.IsNull() && hashSaplingAnchor != SaplingMerkleTree::empty_root()) + if (!hashSaplingAnchor.IsNull()) batch.Write(DB_BEST_SAPLING_ANCHOR, hashSaplingAnchor); LogPrint("coindb", "Committing %u changed transactions (out of %u) to coin database...\n", (unsigned int)changed, (unsigned int)count);