Browse Source

listreceivedbyaddress now provides tx ids (issue #1149)

miguelfreitas
Andrey 12 years ago
parent
commit
62c9b1155f
  1. 8
      src/rpcwallet.cpp

8
src/rpcwallet.cpp

@ -813,6 +813,7 @@ struct tallyitem
{ {
int64 nAmount; int64 nAmount;
int nConf; int nConf;
vector<uint256> txids;
tallyitem() tallyitem()
{ {
nAmount = 0; nAmount = 0;
@ -854,6 +855,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
tallyitem& item = mapTally[address]; tallyitem& item = mapTally[address];
item.nAmount += txout.nValue; item.nAmount += txout.nValue;
item.nConf = min(item.nConf, nDepth); item.nConf = min(item.nConf, nDepth);
item.txids.push_back(wtx.GetHash());
} }
} }
@ -889,6 +891,12 @@ Value ListReceived(const Array& params, bool fByAccounts)
obj.push_back(Pair("account", strAccount)); obj.push_back(Pair("account", strAccount));
obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
Array transactions;
BOOST_FOREACH(const uint256& item, (*it).second.txids)
{
transactions.push_back(item.GetHex());
}
obj.push_back(Pair("txids", transactions));
ret.push_back(obj); ret.push_back(obj);
} }
} }

Loading…
Cancel
Save