aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2017-05-23 10:04:14 -0700
committerLuke Dashjr <[email protected]>2017-06-05 22:58:25 +0000
commit87a21d5922f3cdc7a7e21090dc7078e0774c1c1f (patch)
tree36aec167f07ac4400e3117833c9d0f29e480bfe5 /src/txdb.cpp
parent[wallet] Securely erase potentially sensitive keys/values (diff)
downloaddiscoin-87a21d5922f3cdc7a7e21090dc7078e0774c1c1f.tar.xz
discoin-87a21d5922f3cdc7a7e21090dc7078e0774c1c1f.zip
Fix: make CCoinsViewDbCursor::Seek work for missing keys
Thanks to Suhas Daftuar for figuring this out. Github-Pull: #10445 Rebased-From: 822755a424d0abfa408dc34313f4aca4b816f54f
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 1a30bb58a..662e7cb06 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;
}