diff options
author | woodser <woodser@protonmail.com> | 2022-01-30 17:03:56 -0500 |
---|---|---|
committer | woodser <woodser@protonmail.com> | 2022-01-31 07:52:38 -0500 |
commit | e5000a9f0c664a7c2b522c8a7eb712ed178923f6 (patch) | |
tree | 0350f2d4611d92dd287a1acf0a8bc7dce130a18c /src/wallet/wallet2.cpp | |
parent | Merge pull request #8135 (diff) | |
download | monero-e5000a9f0c664a7c2b522c8a7eb712ed178923f6.tar.xz |
Balance includes unconfirmed transfers to self
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index f36fa73e0..006aef33e 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6126,6 +6126,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; + } + } } } |