mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
wallet: Have cursor users use DatabaseCursor directly
Instead of having the DatabaseBatch manage the cursor, having the consumer handle it directly
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user