Merge pull request #8159
fb018df
Balance includes unconfirmed transfers to self (woodser)
This commit is contained in:
commit
34dd47510a
|
@ -6048,6 +6048,19 @@ std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_majo
|
||||||
amount_per_subaddr[0] = utx.second.m_change;
|
amount_per_subaddr[0] = utx.second.m_change;
|
||||||
else
|
else
|
||||||
found->second += utx.second.m_change;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ class TransferTest():
|
||||||
assert e.double_spend_seen == False
|
assert e.double_spend_seen == False
|
||||||
assert not 'confirmations' in e or e.confirmations == 0
|
assert not 'confirmations' in e or e.confirmations == 0
|
||||||
|
|
||||||
running_balances[0] -= 1000000000000 + fee
|
running_balances[0] -= fee
|
||||||
|
|
||||||
res = self.wallet[0].get_balance()
|
res = self.wallet[0].get_balance()
|
||||||
assert res.balance == running_balances[0]
|
assert res.balance == running_balances[0]
|
||||||
|
@ -183,8 +183,6 @@ class TransferTest():
|
||||||
running_balances[0] += res.block_header.reward
|
running_balances[0] += res.block_header.reward
|
||||||
self.wallet[0].refresh()
|
self.wallet[0].refresh()
|
||||||
|
|
||||||
running_balances[0] += 1000000000000
|
|
||||||
|
|
||||||
res = self.wallet[0].get_transfers()
|
res = self.wallet[0].get_transfers()
|
||||||
assert len(res['in']) == height # coinbases
|
assert len(res['in']) == height # coinbases
|
||||||
assert len(res.out) == 1 # not mined yet
|
assert len(res.out) == 1 # not mined yet
|
||||||
|
@ -337,7 +335,7 @@ class TransferTest():
|
||||||
assert len(res.unsigned_txset) == 0
|
assert len(res.unsigned_txset) == 0
|
||||||
unsigned_txset = res.unsigned_txset
|
unsigned_txset = res.unsigned_txset
|
||||||
|
|
||||||
running_balances[0] -= 1000000000000 + 1100000000000 + 1200000000000 + fee
|
running_balances[0] -= 1100000000000 + 1200000000000 + fee
|
||||||
|
|
||||||
res = self.wallet[0].get_balance()
|
res = self.wallet[0].get_balance()
|
||||||
assert res.balance == running_balances[0]
|
assert res.balance == running_balances[0]
|
||||||
|
@ -347,7 +345,6 @@ class TransferTest():
|
||||||
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
||||||
res = daemon.getlastblockheader()
|
res = daemon.getlastblockheader()
|
||||||
running_balances[0] += res.block_header.reward
|
running_balances[0] += res.block_header.reward
|
||||||
running_balances[0] += 1000000000000
|
|
||||||
running_balances[1] += 1100000000000
|
running_balances[1] += 1100000000000
|
||||||
running_balances[2] += 1200000000000
|
running_balances[2] += 1200000000000
|
||||||
self.wallet[0].refresh()
|
self.wallet[0].refresh()
|
||||||
|
|
Loading…
Reference in New Issue