db: Change DatabaseCursor::Next to return status enum

Next()'s result is a tri-state - failed, more to go, complete. Replace
the way that this is returned with an enum with values FAIL, MORE, and
DONE rather than with two booleans.
This commit is contained in:
Andrew Chow
2022-11-29 22:34:26 -05:00
parent d79e8dcf29
commit 4aebd832a4
11 changed files with 49 additions and 55 deletions

View File

@@ -60,9 +60,9 @@ bool HasAnyRecordOfType(WalletDatabase& db, const std::string& key)
while (true) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
bool complete;
BOOST_CHECK(cursor->Next(ssKey, ssValue, complete));
if (complete) break;
DatabaseCursor::Status status = cursor->Next(ssKey, ssValue);
assert(status != DatabaseCursor::Status::FAIL);
if (status == DatabaseCursor::Status::DONE) break;
std::string type;
ssKey >> type;
if (type == key) return true;