diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-10-29 20:10:46 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-10-29 20:10:46 +0000 |
commit | 7be46ce487e2f3c6e145b9bc56cc37d8de97df9e (patch) | |
tree | 31faa0f74ff1541946f6d0d5d8764be8e2564a66 /db.h | |
parent | fc0e97a70ee295da44096fa590a1f7674b936590 (diff) |
better wallet.dat flush, consolidated QueryPerformanceCounter, PRI64d printf portability
Diffstat (limited to 'db.h')
-rw-r--r-- | db.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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);
}
|