mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Refactor: Move GetAccountAddresses to CWallet
This commit is contained in:
parent
618855133d
commit
3624356e82
@ -421,17 +421,6 @@ Value getreceivedbyaddress(const Array& params, bool fHelp)
|
||||
}
|
||||
|
||||
|
||||
void GetAccountAddresses(string strAccount, set<CTxDestination>& setAddress)
|
||||
{
|
||||
BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, pwalletMain->mapAddressBook)
|
||||
{
|
||||
const CTxDestination& address = item.first;
|
||||
const string& strName = item.second.name;
|
||||
if (strName == strAccount)
|
||||
setAddress.insert(address);
|
||||
}
|
||||
}
|
||||
|
||||
Value getreceivedbyaccount(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
@ -446,8 +435,7 @@ Value getreceivedbyaccount(const Array& params, bool fHelp)
|
||||
|
||||
// Get the set of pub keys assigned to account
|
||||
string strAccount = AccountFromValue(params[0]);
|
||||
set<CTxDestination> setAddress;
|
||||
GetAccountAddresses(strAccount, setAddress);
|
||||
set<CTxDestination> setAddress = pwalletMain->GetAccountAddresses(strAccount);
|
||||
|
||||
// Tally
|
||||
int64 nAmount = 0;
|
||||
|
@ -1812,6 +1812,19 @@ set< set<CTxDestination> > CWallet::GetAddressGroupings()
|
||||
return ret;
|
||||
}
|
||||
|
||||
set<CTxDestination> CWallet::GetAccountAddresses(string strAccount) const
|
||||
{
|
||||
set<CTxDestination> result;
|
||||
BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, mapAddressBook)
|
||||
{
|
||||
const CTxDestination& address = item.first;
|
||||
const string& strName = item.second.name;
|
||||
if (strName == strAccount)
|
||||
result.insert(address);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CReserveKey::GetReservedKey(CPubKey& pubkey)
|
||||
{
|
||||
if (nIndex == -1)
|
||||
|
@ -73,11 +73,6 @@ public:
|
||||
CAddressBookData()
|
||||
{
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
READWRITE(name);
|
||||
)
|
||||
};
|
||||
|
||||
/** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
|
||||
@ -230,6 +225,8 @@ public:
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user