aboutsummaryrefslogtreecommitdiff
path: root/db.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-10-29 20:10:46 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-10-29 20:10:46 +0000
commite8474beb6f2c5e2654f8ebc671b3dbf5fae78563 (patch)
tree31faa0f74ff1541946f6d0d5d8764be8e2564a66 /db.h
parentdc73b326f97f2ed7ec7b7e8485ebc9eb46e05ddb (diff)
better wallet.dat flush, consolidated QueryPerformanceCounter, PRI64d printf portability
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@20 1a98c847-1fd6-4fd8-948a-caf3550aa51b
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);
}