aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2017-05-23 10:04:14 -0700
committerGregory Maxwell <[email protected]>2017-05-23 22:25:52 +0000
commit822755a424d0abfa408dc34313f4aca4b816f54f (patch)
treeb7f4a7d2be9b936d38bc62e948c7e334c62cc1d2 /src/txdb.cpp
parentMerge #10313: [Consensus] Add constant for maximum stack size (diff)
downloaddiscoin-822755a424d0abfa408dc34313f4aca4b816f54f.tar.xz
discoin-822755a424d0abfa408dc34313f4aca4b816f54f.zip
Fix: make CCoinsViewDbCursor::Seek work for missing keys
Thanks to Suhas Daftuar for figuring this out.
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 42dc31760..76aab2398 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -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;
}