X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwalletdb.h;h=94b355f9256bc0cbf12e75d266baf10e79595198;hb=5f3f7465db4444e49dd4a896f88c090b40d0a303;hp=1739693061db888e2ade0941ac7b50f3830c8b00;hpb=b032c4a33e27deebe9210347048998ecc4624ee4;p=novacoin.git diff --git a/src/walletdb.h b/src/walletdb.h index 1739693..94b355f 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -6,7 +6,7 @@ #define BITCOIN_WALLETDB_H #include "db.h" -#include "base58.h" +//#include "base58.h" #include "keystore.h" class CKeyPool; @@ -95,6 +95,33 @@ public: return true; } + bool WriteMalleableKey(const CMalleableKeyView& keyView, const CSecret& vchSecretH, const CKeyMetadata &keyMeta) + { + nWalletDBUpdated++; + if(!Write(std::make_pair(std::string("malmeta"), keyView.ToString()), keyMeta)) + return false; + + if(!Write(std::make_pair(std::string("malpair"), keyView.ToString()), vchSecretH, false)) + return false; + + return true; + } + + bool WriteCryptedMalleableKey(const CMalleableKeyView& keyView, const std::vector& vchCryptedSecretH, const CKeyMetadata &keyMeta) + { + nWalletDBUpdated++; + if(!Write(std::make_pair(std::string("malmeta"), keyView.ToString()), keyMeta)) + return false; + + if(!Write(std::make_pair(std::string("malcpair"), keyView.ToString()), vchCryptedSecretH, false)) + return false; + + Erase(std::make_pair(std::string("malpair"), keyView.ToString())); + + return true; + } + + bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector& vchCryptedSecret, const CKeyMetadata &keyMeta) { nWalletDBUpdated++; @@ -130,6 +157,11 @@ public: return Erase(std::make_pair(std::string("ckey"), vchPubKey.Raw())); } + bool EraseCryptedMalleableKey(const CMalleableKeyView& keyView) + { + return Erase(std::make_pair(std::string("malcpair"), keyView.ToString())); + } + bool WriteCScript(const uint160& hash, const CScript& redeemScript) { nWalletDBUpdated++; @@ -188,25 +220,6 @@ public: return Erase(std::make_pair(std::string("pool"), nPool)); } - // Settings are no longer stored in wallet.dat; these are - // used only for backwards compatibility: - template - bool ReadSetting(const std::string& strKey, T& value) - { - return Read(std::make_pair(std::string("setting"), strKey), value); - } - template - bool WriteSetting(const std::string& strKey, const T& value) - { - nWalletDBUpdated++; - return Write(std::make_pair(std::string("setting"), strKey), value); - } - bool EraseSetting(const std::string& strKey) - { - nWalletDBUpdated++; - return Erase(std::make_pair(std::string("setting"), strKey)); - } - bool WriteMinVersion(int nVersion) { return Write(std::string("minversion"), nVersion); @@ -223,6 +236,9 @@ public: DBErrors ReorderTransactions(CWallet*); DBErrors LoadWallet(CWallet* pwallet); + DBErrors FindWalletTx(CWallet* pwallet, std::vector& vTxHash); + DBErrors ZapWalletTx(CWallet* pwallet); + static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys); static bool Recover(CDBEnv& dbenv, std::string filename); };