diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-04-11 16:07:58 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2022-12-16 12:35:54 -0500 |
commit | d79e8dcf2981ef1964a2fde8c472b5de1ca1c963 (patch) | |
tree | 8331e7c8f23fcdaa0d4f84d45735a34d1be0985f /src/wallet/dump.cpp | |
parent | 7a198bba0a1d0a0f0fd4ca947955cb52b84bdd4b (diff) |
wallet: Have cursor users use DatabaseCursor directly
Instead of having the DatabaseBatch manage the cursor, having the
consumer handle it directly
Diffstat (limited to 'src/wallet/dump.cpp')
-rw-r--r-- | src/wallet/dump.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wallet/dump.cpp b/src/wallet/dump.cpp index 2e46cf5454..ed3b05f118 100644 --- a/src/wallet/dump.cpp +++ b/src/wallet/dump.cpp @@ -47,7 +47,8 @@ bool DumpWallet(const ArgsManager& args, CWallet& wallet, bilingual_str& error) std::unique_ptr<DatabaseBatch> batch = db.MakeBatch(); bool ret = true; - if (!batch->StartCursor()) { + std::unique_ptr<DatabaseCursor> cursor = batch->GetNewCursor(); + if (!cursor) { error = _("Error: Couldn't create cursor into database"); ret = false; } @@ -69,7 +70,7 @@ bool DumpWallet(const ArgsManager& args, CWallet& wallet, bilingual_str& error) CDataStream ss_key(SER_DISK, CLIENT_VERSION); CDataStream ss_value(SER_DISK, CLIENT_VERSION); bool complete; - ret = batch->ReadAtCursor(ss_key, ss_value, complete); + ret = cursor->Next(ss_key, ss_value, complete); if (complete) { ret = true; break; @@ -85,7 +86,7 @@ bool DumpWallet(const ArgsManager& args, CWallet& wallet, bilingual_str& error) } } - batch->CloseCursor(); + cursor.reset(); batch.reset(); // Close the wallet after we're done with it. The caller won't be doing this |