Merge pull request #8158

e5000a9 Balance includes unconfirmed transfers to self (woodser)
This commit is contained in:
luigi1111 2022-03-18 16:28:16 -05:00
commit d9e6baac42
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
2 changed files with 15 additions and 5 deletions

View file

@ -5833,6 +5833,19 @@ std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_majo
amount_per_subaddr[0] = utx.second.m_change;
else
found->second += utx.second.m_change;
// add transfers to same wallet
for (const auto &dest: utx.second.m_dests) {
auto index = get_subaddress_index(dest.addr);
if (index && (*index).major == index_major)
{
auto found = amount_per_subaddr.find((*index).minor);
if (found == amount_per_subaddr.end())
amount_per_subaddr[(*index).minor] = dest.amount;
else
found->second += dest.amount;
}
}
}
}