Skip to content

Commit 822755a

Browse files
sipagmaxwell
authored andcommitted
Fix: make CCoinsViewDbCursor::Seek work for missing keys
Thanks to Suhas Daftuar for figuring this out.
1 parent 4cb8757 commit 822755a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/txdb.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ CCoinsViewCursor *CCoinsViewDB::Cursor() const
9898
that restriction. */
9999
i->pcursor->Seek(DB_COINS);
100100
// Cache key of first record
101-
i->pcursor->GetKey(i->keyTmp);
101+
if (i->pcursor->Valid()) {
102+
i->pcursor->GetKey(i->keyTmp);
103+
} else {
104+
i->keyTmp.first = 0; // Make sure Valid() and GetKey() return false
105+
}
102106
return i;
103107
}
104108

0 commit comments

Comments
 (0)