forked from lthn/blockchain
little tweak on wallet unconfirmed balance
This commit is contained in:
parent
fc3922996d
commit
e77831f1f9
2 changed files with 4 additions and 7 deletions
|
|
@ -3754,13 +3754,10 @@ bool wallet2::balance(std::unordered_map<crypto::public_key, wallet_public::asse
|
|||
for (const auto& emp_entry : utx.second.employed_entries.receive)
|
||||
{
|
||||
auto it_employed_entry = subtransfers_by_assets_map.find(emp_entry.asset_id);
|
||||
if (it_employed_entry == subtransfers_by_assets_map.end())
|
||||
{
|
||||
LOG_ERROR("Intenral error, check the wallet code at give location");
|
||||
continue;
|
||||
}
|
||||
if (!(it_employed_entry->second)) // if is_incoming == false, then we need to check for change and add it to total
|
||||
if (it_employed_entry == subtransfers_by_assets_map.end() || !(it_employed_entry->second)) // if is_incoming == false, then we need to check for change and add it to total
|
||||
{
|
||||
//it_employed_entry == subtransfers_by_assets_map.end() is a case when amount sent exactly equal amount received (someone producing more outputs for example)
|
||||
//still need to add to total as it is a change
|
||||
wallet_public::asset_balance_entry_base& e = balances[emp_entry.asset_id];
|
||||
e.total += emp_entry.amount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1433,7 +1433,7 @@ namespace tools
|
|||
res.status = e.what();
|
||||
return true;
|
||||
}
|
||||
res.status = API_RETURN_CODE_OK;
|
||||
res.status = API_RETURN_CODE_OK;
|
||||
return true;
|
||||
WALLET_RPC_CATCH_TRY_ENTRY();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue