aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-08 16:20:08 +0000
committerWladimir J. van der Laan <laanwj@gmail.com>2017-04-20 17:55:01 +0200
commit33232810dca802a1328e349865d7da86c8c809e1 (patch)
tree49ff69835af92b9f18f898d1bedc5012ac3f5601 /src/wallet/walletdb.h
parentbe9e1a968debbb7ede8ed50e9288a62ff15d1e1e (diff)
downloadbitcoin-33232810dca802a1328e349865d7da86c8c809e1.tar.xz
wallet: CWalletDB CDB composition not inheritance
CWalletDB now contains a CDB instead of inheriting from it. This makes it easier to replace the internal transaction with a different database, without leaking through internals.
Diffstat (limited to 'src/wallet/walletdb.h')
-rw-r--r--src/wallet/walletdb.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index c0135a6292..98a65a130c 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -123,10 +123,11 @@ public:
* database. It will be committed when the object goes out of scope.
* Optionally (on by default) it will flush to disk as well.
*/
-class CWalletDB : public CDB
+class CWalletDB
{
public:
- CWalletDB(CWalletDBWrapper& dbw, const char* pszMode = "r+", bool _fFlushOnClose = true) : CDB(dbw, pszMode, _fFlushOnClose)
+ CWalletDB(CWalletDBWrapper& dbw, const char* pszMode = "r+", bool _fFlushOnClose = true) :
+ batch(dbw, pszMode, _fFlushOnClose)
{
}
@@ -198,7 +199,20 @@ public:
static void IncrementUpdateCounter();
static unsigned int GetUpdateCounter();
+
+ //! Begin a new transaction
+ bool TxnBegin();
+ //! Commit current transaction
+ bool TxnCommit();
+ //! Abort current transaction
+ bool TxnAbort();
+ //! Read wallet version
+ bool ReadVersion(int& nVersion);
+ //! Write wallet version
+ bool WriteVersion(int nVersion);
private:
+ CDB batch;
+
CWalletDB(const CWalletDB&);
void operator=(const CWalletDB&);
};