aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
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