rpc: Fix leveldb iterator leak, and flush before gettxoutsetinfo

This fixes an iterator leak resulting in

    bitcoind: db/version_set.cc:789: leveldb::VersionSet::~VersionSet(): Assertion `dummy_versions_.next_ == &dummy_versions_' failed."

exception on shutdown.

Also make sure to flush pcoinsTip before calling GetStats() to make
sure we apply them to the current height.
This commit is contained in:
Wladimir J. van der Laan
2014-10-21 16:08:20 +02:00
parent 9acbb4180a
commit 33dfbf57d3
2 changed files with 2 additions and 1 deletions

View File

@@ -319,6 +319,7 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
Object ret;
CCoinsStats stats;
pcoinsTip->Flush();
if (pcoinsTip->GetStats(stats)) {
ret.push_back(Pair("height", (int64_t)stats.nHeight));
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));