From d79e8dcf2981ef1964a2fde8c472b5de1ca1c963 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 11 Apr 2022 16:07:58 -0400 Subject: wallet: Have cursor users use DatabaseCursor directly Instead of having the DatabaseBatch manage the cursor, having the consumer handle it directly --- src/wallet/dump.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/wallet/dump.cpp') 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 batch = db.MakeBatch(); bool ret = true; - if (!batch->StartCursor()) { + std::unique_ptr 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 -- cgit v1.2.3