rpc: add receieved to balance

This commit is contained in:
Braydon Fuller 2016-03-17 16:40:16 -04:00 committed by Simon
parent d2e961bd94
commit c4c22aefc3
1 changed files with 5 additions and 0 deletions

View File

@ -572,13 +572,18 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp)
}
CAmount balance = 0;
CAmount received = 0;
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
if (it->second > 0) {
received += it->second;
}
balance += it->second;
}
UniValue result(UniValue::VOBJ);
result.push_back(Pair("balance", balance));
result.push_back(Pair("received", received));
return result;