diff options
author | Jeff Garzik <jgarzik@bitpay.com> | 2013-05-30 07:42:01 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@bitpay.com> | 2013-05-30 07:42:01 -0700 |
commit | 9d01dd7658b38ba947347156e13b677ee57d80b4 (patch) | |
tree | 6925220f8f3b842791514923f7fa8e8488beede4 /src/rpcwallet.cpp | |
parent | af93273799cb169bdcea97e3c02089db617247d8 (diff) | |
parent | 1a20469428ef623f4edc2cdac72aef001836536c (diff) |
Merge pull request #2104 from al42and/listreceivedbyaddress_txids
listreceivedbyaddress now provides tx ids (issue #1149)
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 5fd400c6bb..e156469d11 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -811,6 +811,7 @@ struct tallyitem { int64 nAmount; int nConf; + vector<uint256> txids; tallyitem() { nAmount = 0; @@ -852,6 +853,7 @@ Value ListReceived(const Array& params, bool fByAccounts) tallyitem& item = mapTally[address]; item.nAmount += txout.nValue; item.nConf = min(item.nConf, nDepth); + item.txids.push_back(wtx.GetHash()); } } @@ -887,6 +889,15 @@ Value ListReceived(const Array& params, bool fByAccounts) obj.push_back(Pair("account", strAccount)); obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); + Array transactions; + if (it != mapTally.end()) + { + BOOST_FOREACH(const uint256& item, (*it).second.txids) + { + transactions.push_back(item.GetHex()); + } + } + obj.push_back(Pair("txids", transactions)); ret.push_back(obj); } } @@ -919,7 +930,8 @@ Value listreceivedbyaddress(const Array& params, bool fHelp) " \"address\" : receiving address\n" " \"account\" : the account of the receiving address\n" " \"amount\" : total amount received by the address\n" - " \"confirmations\" : number of confirmations of the most recent transaction included"); + " \"confirmations\" : number of confirmations of the most recent transaction included\n" + " \"txids\" : list of transactions with outputs to the address\n"); return ListReceived(params, false); } |