From 2ffba736e9102d016b96c2e5de2ce7757e612667 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 5 Jul 2011 20:53:43 +0200 Subject: Use CBitcoinAddress instead of string/uint160 Instead of conversion functions between pubkey/uint160/address in base58.h, have a fully fledged class CBitcoinAddress (CAddress was already taken) to represent addresses. --- src/wallet.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/wallet.h') diff --git a/src/wallet.h b/src/wallet.h index 277d0b1e79..51dfa5df5b 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -53,7 +53,7 @@ public: std::map mapRequestCount; mutable CCriticalSection cs_mapRequestCount; - std::map mapAddressBook; + std::map mapAddressBook; mutable CCriticalSection cs_mapAddressBook; std::vector vchDefaultKey; @@ -81,7 +81,7 @@ public: bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); bool BroadcastTransaction(CWalletTx& wtxNew); std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); - std::string SendMoneyToBitcoinAddress(std::string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); + std::string SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); bool TopUpKeyPool(); void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool); @@ -104,10 +104,10 @@ public: } bool IsChange(const CTxOut& txout) const { - uint160 hash160; - if (ExtractHash160(txout.scriptPubKey, this, hash160)) + CBitcoinAddress address; + if (ExtractAddress(txout.scriptPubKey, this, address)) CRITICAL_BLOCK(cs_mapAddressBook) - if (!mapAddressBook.count(Hash160ToAddress(hash160))) + if (!mapAddressBook.count(address)) return true; return false; } @@ -171,10 +171,10 @@ public: // bool BackupWallet(const std::string& strDest); // requires cs_mapAddressBook lock - bool SetAddressBookName(const std::string& strAddress, const std::string& strName); + bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); // requires cs_mapAddressBook lock - bool DelAddressBookName(const std::string& strAddress); + bool DelAddressBookName(const CBitcoinAddress& address); void UpdatedTransaction(const uint256 &hashTx) { @@ -464,8 +464,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