diff options
author | Gregory Maxwell <greg@xiph.org> | 2012-08-24 00:46:24 -0700 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2012-08-24 00:46:24 -0700 |
commit | c68c4bc7a45529735c868428632906d3c20a175a (patch) | |
tree | 6edd9d67279c0c15729c752c12794cf34864c930 /src/rpcwallet.cpp | |
parent | bdab0cf58c2ac1b90ba2723e8f9ddc1817b3d811 (diff) | |
parent | b1093efa833376a7883deb0cbcddd0aed364de84 (diff) |
Merge pull request #1672 from gmaxwell/filter_listunspent
Listunspent txout address filtering and listaddressgroupings
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 2e284b07df..be83b85c15 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -274,6 +274,37 @@ Value sendtoaddress(const Array& params, bool fHelp) return wtx.GetHash().GetHex(); } +Value listaddressgroupings(const Array& params, bool fHelp) +{ + if (fHelp) + throw runtime_error( + "listaddressgroupings\n" + "Lists groups of addresses which have had their common ownership\n" + "made public by common use as inputs or as the resulting change\n" + "in past transactions"); + + Array jsonGroupings; + map<CTxDestination, int64> balances = pwalletMain->GetAddressBalances(); + BOOST_FOREACH(set<CTxDestination> grouping, pwalletMain->GetAddressGroupings()) + { + Array jsonGrouping; + BOOST_FOREACH(CTxDestination address, grouping) + { + Array addressInfo; + addressInfo.push_back(CBitcoinAddress(address).ToString()); + addressInfo.push_back(ValueFromAmount(balances[address])); + { + LOCK(pwalletMain->cs_wallet); + if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end()) + addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second); + } + jsonGrouping.push_back(addressInfo); + } + jsonGroupings.push_back(jsonGrouping); + } + return jsonGroupings; +} + Value signmessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) |