From 17f2ea5d73926600adad12e49c9f907acb632b09 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 19 Apr 2016 10:23:23 +0200 Subject: [PATCH] Merge #7904: txdb: Fix assert crash in new UTXO set cursor a3310b4 txdb: Fix assert crash in new UTXO set cursor (Wladimir J. van der Laan) --- src/txdb.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 3faea531e..45d486e77 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -138,12 +138,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 >& fileInfo, int nLastFile, const std::vector& blockinfo) {