aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-15 16:08:38 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-15 16:42:44 +0200
commitd4211176208b5e4ae4a699c6ce3239447752cdb2 (patch)
tree2f1c91d534d1571e3a04c000d66590964bbc213e /src/db.h
parenta24b23622e504f5134dd8011af5bbe68cb9443f1 (diff)
parent5b0fc31b1c3d25039262ae2043474b35c14bd30b (diff)
Merge branch 'master' of https://github.com/bitcoin/bitcoin
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/db.h b/src/db.h
index b89b34e009..049857b3ab 100644
--- a/src/db.h
+++ b/src/db.h
@@ -88,7 +88,7 @@ protected:
if (!pdb)
return false;
if (fReadOnly)
- assert(("Write called on database in read-only mode", false));
+ assert(!"Write called on database in read-only mode");
// Key
CDataStream ssKey(SER_DISK);
@@ -117,7 +117,7 @@ protected:
if (!pdb)
return false;
if (fReadOnly)
- assert(("Erase called on database in read-only mode", false));
+ assert(!"Erase called on database in read-only mode");
// Key
CDataStream ssKey(SER_DISK);
@@ -342,6 +342,14 @@ public:
+enum DBErrors
+{
+ DB_LOAD_OK,
+ DB_CORRUPT,
+ DB_TOO_NEW,
+ DB_LOAD_FAIL,
+};
+
class CWalletDB : public CDB
{
public:
@@ -391,6 +399,25 @@ public:
return Write(std::make_pair(std::string("key"), vchPubKey), vchPrivKey, false);
}
+ bool WriteCryptedKey(const std::vector<unsigned char>& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, bool fEraseUnencryptedKey = true)
+ {
+ nWalletDBUpdated++;
+ if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false))
+ return false;
+ if (fEraseUnencryptedKey)
+ {
+ Erase(std::make_pair(std::string("key"), vchPubKey));
+ Erase(std::make_pair(std::string("wkey"), vchPubKey));
+ }
+ return true;
+ }
+
+ bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey)
+ {
+ nWalletDBUpdated++;
+ return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true);
+ }
+
bool WriteBestBlock(const CBlockLocator& locator)
{
nWalletDBUpdated++;
@@ -450,7 +477,7 @@ public:
int64 GetAccountCreditDebit(const std::string& strAccount);
void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& acentries);
- bool LoadWallet(CWallet* pwallet);
+ int LoadWallet(CWallet* pwallet);
};
#endif