aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-03-18 16:28:16 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-03-18 16:28:16 -0500
commitd9e6baac421254988ea8a5b23e19aa7aec322658 (patch)
tree37f4a9b6dd7278e7e17cbe6cecfe5e60f96e0325 /src/wallet/wallet2.cpp
parentMerge pull request #7675 (diff)
parentBalance includes unconfirmed transfers to self (diff)
downloadmonero-d9e6baac421254988ea8a5b23e19aa7aec322658.tar.xz
Merge pull request #8158
e5000a9 Balance includes unconfirmed transfers to self (woodser)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e95e53e0c..9e95a26c1 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -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;
+ }
+ }
}
}