From b039e29c174306b292dc6f9313c8ef3d107aa70f Mon Sep 17 00:00:00 2001 From: jc Date: Mon, 25 Jun 2018 09:55:49 -0400 Subject: [PATCH] Don't write a null anchor to chainstate --- src/txdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index ef620e951..5bdb9ed8b 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -192,7 +192,8 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, // In the last batch, mark the database as consistent with hashBlock again. batch.Erase(DB_HEAD_BLOCKS); batch.Write(DB_BEST_BLOCK, hashBlock); - batch.Write(DB_BEST_ANCHOR, hashAnchor); + if(!hashAnchor.IsNull()) + batch.Write(DB_BEST_ANCHOR, hashAnchor); LogPrint(BCLog::COINDB, "Writing final batch of %.2f MiB\n", batch.SizeEstimate() * (1.0 / 1048576.0)); bool ret = db.WriteBatch(batch);