From fb018df6e5b2b6c3ccc8bee1c1b7fa065515eef8 Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 30 Jan 2022 17:03:56 -0500 Subject: Balance includes unconfirmed transfers to self --- src/wallet/wallet2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/wallet/wallet2.cpp') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index cbdda4f72..436712ab6 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6047,6 +6047,19 @@ std::map 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; + } + } } } } -- cgit v1.2.3