Merge pull request #17 from jc23424/anchor-chainstate-fix

Don't write a null anchor to chainstate
This commit is contained in:
CryptoJake22 2018-06-26 20:37:18 -07:00 committed by GitHub
commit 0e5dd3b1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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);