Browse Source

Fix: make CCoinsViewDbCursor::Seek work for missing keys

Thanks to Suhas Daftuar for figuring this out.
0.15
Pieter Wuille 7 years ago committed by Gregory Maxwell
parent
commit
822755a424
  1. 6
      src/txdb.cpp

6
src/txdb.cpp

@ -98,7 +98,11 @@ CCoinsViewCursor *CCoinsViewDB::Cursor() const @@ -98,7 +98,11 @@ CCoinsViewCursor *CCoinsViewDB::Cursor() const
that restriction. */
i->pcursor->Seek(DB_COINS);
// Cache key of first record
i->pcursor->GetKey(i->keyTmp);
if (i->pcursor->Valid()) {
i->pcursor->GetKey(i->keyTmp);
} else {
i->keyTmp.first = 0; // Make sure Valid() and GetKey() return false
}
return i;
}

Loading…
Cancel
Save