From d6af06d68aae985436cbc942f0d11078041d121b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 17 Apr 2017 11:41:10 -0400 Subject: Dont create pcoinsTip until after ReplayBlocks. This requires that we not access pcoinsTip in InitBlockIndex's FlushStateToDisk (so we just skip it until later in AppInitMain) and the LoadChainTip in LoadBlockIndex (which there is already one later in AppinitMain, after ReplayBlocks, so skipping it there is fine). Includes some simplifications by Suhas Daftuar and Pieter Wuille. --- src/txdb.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/txdb.cpp') diff --git a/src/txdb.cpp b/src/txdb.cpp index 7de11cc617..4cdfc7d6f5 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -85,6 +85,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { size_t changed = 0; size_t batch_size = (size_t)GetArg("-dbbatchsize", nDefaultDbBatchSize); int crash_simulate = GetArg("-dbcrashratio", 0); + assert(!hashBlock.IsNull()); uint256 old_tip = GetBestBlock(); if (old_tip.IsNull()) { @@ -96,13 +97,6 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { } } - if (hashBlock.IsNull()) { - // Initial flush, nothing to write. - assert(mapCoins.empty()); - assert(old_tip.IsNull()); - return true; - } - // In the first batch, mark the database as being in the middle of a // transition from old_tip to hashBlock. // A vector is used for future extensibility, as we may want to support -- cgit v1.2.3