mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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.
This commit is contained in:
16
src/wallet.h
16
src/wallet.h
@@ -105,7 +105,7 @@ public:
|
||||
std::map<uint256, CWalletTx> mapWallet;
|
||||
std::map<uint256, int> mapRequestCount;
|
||||
|
||||
std::map<CBitcoinAddress, std::string> mapAddressBook;
|
||||
std::map<CTxDestination, std::string> 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<CBitcoinAddress>& setAddress);
|
||||
void GetAllReserveKeys(std::set<CKeyID>& 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<void (CWallet *wallet, const std::string &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, ChangeType status)> 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<std::pair<CBitcoinAddress, int64> >& listReceived,
|
||||
std::list<std::pair<CBitcoinAddress, int64> >& listSent, int64& nFee, std::string& strSentAccount) const;
|
||||
void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CTxDestination, int64> >& listReceived,
|
||||
std::list<std::pair<CTxDestination, int64> >& listSent, int64& nFee, std::string& strSentAccount) const;
|
||||
|
||||
void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived,
|
||||
int64& nSent, int64& nFee) const;
|
||||
|
||||
Reference in New Issue
Block a user