X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.h;h=fb02d0222a44104283dfb1601c8168b798684704;hb=1d40b6207e7d1591c47cce149aae84bb60dcc416;hp=8480b3b8669a503cd1eee8b44d362b46c4b856bd;hpb=44de02325859a145a260545159767e4cbd4ec938;p=novacoin.git diff --git a/src/wallet.h b/src/wallet.h index 8480b3b..fb02d02 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -17,6 +17,7 @@ #include "ui_interface.h" #include "util.h" #include "walletdb.h" +#include "base58.h" extern unsigned int nStakeMaxAge; extern bool fWalletUnlockMintOnly; @@ -37,7 +38,8 @@ enum WalletFeature FEATURE_WALLETCRYPT = 40000, // wallet encryption FEATURE_COMPRPUBKEY = 60000, // compressed public keys - FEATURE_LATEST = 60000 + FEATURE_MALLKEY = 60017, + FEATURE_LATEST = 60017 }; /** A key pool entry */ @@ -94,7 +96,12 @@ public: std::string strWalletFile; std::set setKeyPool; + /* std::map mapKeyMetadata; + std::map mapMalleableKeyMetadata; + */ + + std::map mapKeyMetadata; typedef std::map MasterKeyMap; MasterKeyMap mapMasterKeys; @@ -130,7 +137,7 @@ public: int64_t nOrderPosNext; std::map mapRequestCount; - std::map mapAddressBook; + std::map mapAddressBook; CPubKey vchDefaultKey; int64_t nTimeFirstKey; @@ -148,17 +155,25 @@ public: // keystore implementation // Generate a new key CPubKey GenerateNewKey(); + CMalleableKeyView GenerateNewMalleableKey(); // Adds a key to the store, and saves it to disk. bool AddKey(const CKey& key); + bool AddKey(const CMalleableKey& mKey); // Adds a key to the store, without saving it to disk (used by LoadWallet) bool LoadKey(const CKey& key) { return CCryptoKeyStore::AddKey(key); } // Load metadata (used by LoadWallet) bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata); + bool LoadKeyMetadata(const CMalleableKeyView &keyView, const CKeyMetadata &metadata); + + // Load malleable key without saving it to disk (used by LoadWallet) + bool LoadKey(const CMalleableKeyView &keyView, const CSecret &vchSecretH) { return CCryptoKeyStore::AddMalleableKey(keyView, vchSecretH); } + bool LoadCryptedKey(const CMalleableKeyView &keyView, const std::vector &vchCryptedSecretH) { return CCryptoKeyStore::AddCryptedMalleableKey(keyView, vchCryptedSecretH); } bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } // Adds an encrypted key to the store, and saves it to disk. bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector &vchCryptedSecret); + bool AddCryptedMalleableKey(const CMalleableKeyView& keyView, const std::vector &vchCryptedSecretH); // Adds an encrypted key to the store, without saving it to disk (used by LoadWallet) bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector &vchCryptedSecret) { SetMinVersion(FEATURE_WALLETCRYPT); return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); } bool AddCScript(const CScript& redeemScript); @@ -175,7 +190,7 @@ public: bool EncryptWallet(const SecureString& strWalletPassphrase); bool DecryptWallet(const SecureString& strWalletPassphrase); - void GetKeyBirthTimes(std::map &mapKeyBirth) const; + void GetAddresses(std::map &mapAddresses) const; /** Increment the next transaction order id @@ -201,7 +216,7 @@ public: int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); int ScanForWalletTransaction(const uint256& hashTx); void ReacceptWalletTransactions(); - void ResendWalletTransactions(); + void ResendWalletTransactions(bool fForceResend=false); int64_t GetBalance() const; int64_t GetWatchOnlyBalance() const; int64_t GetUnconfirmedBalance() const; @@ -221,7 +236,6 @@ public: bool MergeCoins(const int64_t& nAmount, const int64_t& nMinValue, const int64_t& nMaxValue, std::list& listMerged); std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false); - std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false); bool NewKeyPool(unsigned int nSize = 0); bool TopUpKeyPool(unsigned int nSize = 0); @@ -233,8 +247,8 @@ public: int64_t GetOldestKeyPoolTime(); void GetAllReserveKeys(std::set& setAddress) const; - std::set< std::set > GetAddressGroupings(); - std::map GetAddressBalances(); + std::set< std::set > GetAddressGroupings(); + std::map GetAddressBalances(); isminetype IsMine(const CTxIn& txin) const; int64_t GetDebit(const CTxIn& txin, const isminefilter& filter) const; @@ -307,7 +321,9 @@ public: bool SetAddressBookName(const CTxDestination& address, const std::string& strName); - bool DelAddressBookName(const CTxDestination& address); + bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); + + bool DelAddressBookName(const CBitcoinAddress& address); void UpdatedTransaction(const uint256 &hashTx); @@ -347,7 +363,7 @@ public: /** Address book entry changed. * @note called with lock cs_wallet held. */ - boost::signals2::signal NotifyAddressBookChanged; + boost::signals2::signal NotifyAddressBookChanged; /** Wallet transaction added, removed or updated. * @note called with lock cs_wallet held. @@ -785,8 +801,8 @@ public: return nChangeCached; } - void GetAmounts(int64_t& nGeneratedImmature, int64_t& nGeneratedMature, std::list >& listReceived, - std::list >& listSent, int64_t& nFee, std::string& strSentAccount, const isminefilter& filter) const; + void GetAmounts(int64_t& nGeneratedImmature, int64_t& nGeneratedMature, std::list >& listReceived, + std::list >& listSent, int64_t& nFee, std::string& strSentAccount, const isminefilter& filter) const; void GetAccountAmounts(const std::string& strAccount, int64_t& nGenerated, int64_t& nReceived, int64_t& nSent, int64_t& nFee, const isminefilter& filter) const;