aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/dump.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-04-11 16:07:58 -0400
committerAndrew Chow <github@achow101.com>2022-12-16 12:35:54 -0500
commitd79e8dcf2981ef1964a2fde8c472b5de1ca1c963 (patch)
tree8331e7c8f23fcdaa0d4f84d45735a34d1be0985f /src/wallet/dump.cpp
parent7a198bba0a1d0a0f0fd4ca947955cb52b84bdd4b (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.cpp7
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