From 1025440184ef100a22d07c7bb543ee45cf169d64 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 14 May 2012 23:44:52 +0200 Subject: Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress This introduces internal types: * CKeyID: reference (hash160) of a key * CScriptID: reference (hash160) of a script * CTxDestination: a boost::variant of the former two CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code. Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers. --- src/wallet.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/wallet.h') diff --git a/src/wallet.h b/src/wallet.h index 6c99b3c4b8..618a00623a 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -105,7 +105,7 @@ public: std::map mapWallet; std::map mapRequestCount; - std::map mapAddressBook; + std::map mapAddressBook; CPubKey vchDefaultKey; @@ -148,7 +148,7 @@ public: bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); - std::string SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); + std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); bool NewKeyPool(); bool TopUpKeyPool(); @@ -158,7 +158,7 @@ public: void ReturnKey(int64 nIndex); bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true); int64 GetOldestKeyPoolTime(); - void GetAllReserveAddresses(std::set& setAddress); + void GetAllReserveKeys(std::set& setAddress); bool IsMine(const CTxIn& txin) const; int64 GetDebit(const CTxIn& txin) const; @@ -227,9 +227,9 @@ public: int LoadWallet(bool& fFirstRunRet); - bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); + bool SetAddressBookName(const CTxDestination& address, const std::string& strName); - bool DelAddressBookName(const CBitcoinAddress& address); + bool DelAddressBookName(const CTxDestination& address); void UpdatedTransaction(const uint256 &hashTx); @@ -266,7 +266,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. @@ -532,8 +532,8 @@ public: return nChangeCached; } - void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list >& listReceived, - std::list >& listSent, int64& nFee, std::string& strSentAccount) const; + void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list >& listReceived, + std::list >& listSent, int64& nFee, std::string& strSentAccount) const; void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived, int64& nSent, int64& nFee) const; -- cgit v1.2.3