mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #5115
33dfbf5
rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo` (Wladimir J. van der Laan)
This commit is contained in:
commit
d9702bcf7c
@ -319,6 +319,7 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
|
|||||||
Object ret;
|
Object ret;
|
||||||
|
|
||||||
CCoinsStats stats;
|
CCoinsStats stats;
|
||||||
|
pcoinsTip->Flush();
|
||||||
if (pcoinsTip->GetStats(stats)) {
|
if (pcoinsTip->GetStats(stats)) {
|
||||||
ret.push_back(Pair("height", (int64_t)stats.nHeight));
|
ret.push_back(Pair("height", (int64_t)stats.nHeight));
|
||||||
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
|
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
|
||||||
|
@ -104,7 +104,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
|
|||||||
/* It seems that there are no "const iterators" for LevelDB. Since we
|
/* It seems that there are no "const iterators" for LevelDB. Since we
|
||||||
only need read operations on it, use a const-cast to get around
|
only need read operations on it, use a const-cast to get around
|
||||||
that restriction. */
|
that restriction. */
|
||||||
leveldb::Iterator *pcursor = const_cast<CLevelDBWrapper*>(&db)->NewIterator();
|
boost::scoped_ptr<leveldb::Iterator> pcursor(const_cast<CLevelDBWrapper*>(&db)->NewIterator());
|
||||||
pcursor->SeekToFirst();
|
pcursor->SeekToFirst();
|
||||||
|
|
||||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
|
Loading…
Reference in New Issue
Block a user