aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-10-30 13:53:11 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2012-10-30 13:53:11 -0700
commit41db7c224a6a272c5f6fe70e17d28219fa9d66d9 (patch)
treeca3b00ba2f0b4bb636238c7f2bc776e8450b54a3
parentcfec6b2c70225bd704bdb30bc39b5468dfa65b28 (diff)
parent0b297a614f80214dbd826fe5af92b4eaa60911bb (diff)
Merge pull request #1963 from sipa/bugfix_nonewblock
Bugfix: don't crash by trying to write unchanged best block
-rw-r--r--src/txdb.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 67d15cb58f..6550f57876 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -58,7 +58,8 @@ bool CCoinsViewDB::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockI
CLevelDBBatch batch;
for (std::map<uint256, CCoins>::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++)
BatchWriteCoins(batch, it->first, it->second);
- BatchWriteHashBestChain(batch, pindex->GetBlockHash());
+ if (pindex)
+ BatchWriteHashBestChain(batch, pindex->GetBlockHash());
return db.WriteBatch(batch);
}