diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-04-18 12:05:32 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-04-18 12:05:32 +0200 |
| commit | a3310b4d485b1510c240f1db882530590b6fd7c9 (patch) | |
| tree | ad121e15124090ef11d53663ab91938313fe6ea1 /src | |
| parent | Merge #7603: Build System: Use PACKAGE_TARNAME in NSIS script (diff) | |
| download | discoin-a3310b4d485b1510c240f1db882530590b6fd7c9.tar.xz discoin-a3310b4d485b1510c240f1db882530590b6fd7c9.zip | |
txdb: Fix assert crash in new UTXO set cursor
Remove the mistaken assumption that GetKey returning false signifies
an internal database issue. It will return false when the key cannot
be deserialized into the (char,uint256) stanza, which indicates
that the cursor has reached a different kind of key.
Fixes bug #7890 introduced in #7756.
Diffstat (limited to 'src')
| -rw-r--r-- | src/txdb.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp index be86cceeb..19ca17865 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -134,12 +134,8 @@ bool CCoinsViewDBCursor::Valid() const void CCoinsViewDBCursor::Next() { pcursor->Next(); - if (pcursor->Valid()) { - bool ok = pcursor->GetKey(keyTmp); - assert(ok); // If GetKey fails here something must be wrong with underlying database, we cannot handle that here - } else { + if (!pcursor->Valid() || !pcursor->GetKey(keyTmp)) keyTmp.first = 0; // Invalidate cached key after last record so that Valid() and GetKey() return false - } } bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) { |