From ca24edfbc1941ed0a3c9586416dae4e84794eb66 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 14 May 2020 21:17:01 -0400 Subject: walletdb: Handle cursor internally Instead of returning a Dbc (BDB cursor object) and having the caller deal with the cursor, make BerkeleyBatch handle the cursor internally. This prepares BerkeleyBatch to work with other database systems as Dbc objects are BDB specific. --- src/wallet/bdb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/wallet/bdb.h') diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h index 5ed364344b..aac5bc016e 100644 --- a/src/wallet/bdb.h +++ b/src/wallet/bdb.h @@ -211,6 +211,7 @@ protected: Db* pdb; std::string strFile; DbTxn* activeTxn; + Dbc* m_cursor; bool fReadOnly; bool fFlushOnClose; BerkeleyEnvironment *env; @@ -323,8 +324,9 @@ public: return (ret == 0); } - Dbc* GetCursor(); - int ReadAtCursor(Dbc* pcursor, CDataStream& ssKey, CDataStream& ssValue); + bool StartCursor(); + bool ReadAtCursor(CDataStream& ssKey, CDataStream& ssValue, bool& complete); + void CloseCursor(); bool TxnBegin(); bool TxnCommit(); bool TxnAbort(); -- cgit v1.2.3