aboutsummaryrefslogtreecommitdiff
path: root/db.h
diff options
context:
space:
mode:
Diffstat (limited to 'db.h')
-rw-r--r--db.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/db.h b/db.h
index 4961468759..d11b397eba 100644
--- a/db.h
+++ b/db.h
@@ -17,7 +17,10 @@ extern map<string, string> mapAddressBook;
extern bool fClient;
+extern unsigned int nWalletDBUpdated;
extern DbEnv dbenv;
+
+
extern void DBFlush(bool fShutdown);
@@ -334,11 +337,11 @@ bool LoadAddresses();
+
class CWalletDB : public CDB
{
public:
CWalletDB(const char* pszMode="r+", bool fTxn=false) : CDB("wallet.dat", pszMode, fTxn) { }
- ~CWalletDB();
private:
CWalletDB(const CWalletDB&);
void operator=(const CWalletDB&);
@@ -351,12 +354,14 @@ public:
bool WriteName(const string& strAddress, const string& strName)
{
+ nWalletDBUpdated++;
mapAddressBook[strAddress] = strName;
return Write(make_pair(string("name"), strAddress), strName);
}
bool EraseName(const string& strAddress)
{
+ nWalletDBUpdated++;
mapAddressBook.erase(strAddress);
return Erase(make_pair(string("name"), strAddress));
}
@@ -368,11 +373,13 @@ public:
bool WriteTx(uint256 hash, const CWalletTx& wtx)
{
+ nWalletDBUpdated++;
return Write(make_pair(string("tx"), hash), wtx);
}
bool EraseTx(uint256 hash)
{
+ nWalletDBUpdated++;
return Erase(make_pair(string("tx"), hash));
}
@@ -384,6 +391,7 @@ public:
bool WriteKey(const vector<unsigned char>& vchPubKey, const CPrivKey& vchPrivKey)
{
+ nWalletDBUpdated++;
return Write(make_pair(string("key"), vchPubKey), vchPrivKey, false);
}
@@ -395,6 +403,7 @@ public:
bool WriteDefaultKey(const vector<unsigned char>& vchPubKey)
{
+ nWalletDBUpdated++;
return Write(string("defaultkey"), vchPubKey);
}
@@ -407,6 +416,7 @@ public:
template<typename T>
bool WriteSetting(const string& strKey, const T& value)
{
+ nWalletDBUpdated++;
return Write(make_pair(string("setting"), strKey), value);
}