diff options
Diffstat (limited to 'src/wallet.h')
-rw-r--r-- | src/wallet.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/wallet.h b/src/wallet.h index 3474045e32..51bc9f67c4 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -64,6 +64,19 @@ public: ) }; +/** Address book data */ +class CAddressBookData +{ +public: + std::string name; + std::string purpose; + + CAddressBookData() + { + purpose = "unknown"; + } +}; + /** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances, * and provides the ability to create new transactions. */ @@ -124,7 +137,7 @@ public: int64 nOrderPosNext; std::map<uint256, int> mapRequestCount; - std::map<CTxDestination, std::string> mapAddressBook; + std::map<CTxDestination, CAddressBookData> mapAddressBook; CPubKey vchDefaultKey; @@ -202,18 +215,20 @@ public: std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); bool NewKeyPool(); - bool TopUpKeyPool(); + bool TopUpKeyPool(unsigned int kpSize = 0); int64 AddReserveKey(const CKeyPool& keypool); void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool); void KeepKey(int64 nIndex); void ReturnKey(int64 nIndex); - bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true); + bool GetKeyFromPool(CPubKey &key); int64 GetOldestKeyPoolTime(); void GetAllReserveKeys(std::set<CKeyID>& setAddress) const; std::set< std::set<CTxDestination> > GetAddressGroupings(); std::map<CTxDestination, int64> GetAddressBalances(); + std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const; + bool IsMine(const CTxIn& txin) const; int64 GetDebit(const CTxIn& txin) const; bool IsMine(const CTxOut& txout) const @@ -281,9 +296,9 @@ public: DBErrors LoadWallet(bool& fFirstRunRet); - bool SetAddressBookName(const CTxDestination& address, const std::string& strName); + bool SetAddressBook(const CTxDestination& address, const std::string& strName, const std::string& purpose); - bool DelAddressBookName(const CTxDestination& address); + bool DelAddressBook(const CTxDestination& address); void UpdatedTransaction(const uint256 &hashTx); @@ -299,7 +314,7 @@ public: } } - int GetKeyPoolSize() + unsigned int GetKeyPoolSize() { return setKeyPool.size(); } @@ -320,12 +335,16 @@ public: /** Address book entry changed. * @note called with lock cs_wallet held. */ - boost::signals2::signal<void (CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status)> NotifyAddressBookChanged; + boost::signals2::signal<void (CWallet *wallet, const CTxDestination + &address, const std::string &label, bool isMine, + const std::string &purpose, + ChangeType status)> NotifyAddressBookChanged; /** Wallet transaction added, removed or updated. * @note called with lock cs_wallet held. */ - boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged; + boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, + ChangeType status)> NotifyTransactionChanged; }; /** A key allocated from the key pool. */ @@ -726,7 +745,7 @@ public: void print() const { - printf("%s\n", ToString().c_str()); + LogPrintf("%s\n", ToString().c_str()); } }; |