1
0
Fork 0
forked from lthn/blockchain

wallet2: take escrow-blocked coins into account when calculating the total balance

This commit is contained in:
sowle 2019-05-02 18:46:24 +02:00
parent afa60fbb03
commit 375e9fd990
2 changed files with 2 additions and 1 deletions

View file

@ -2120,7 +2120,7 @@ uint64_t wallet2::balance(uint64_t& unloked, uint64_t& awaiting_in, uint64_t& aw
for(auto& td : m_transfers)
{
if (td.is_spendable())
if (td.is_spendable() || td.is_reserved_for_escrow())
{
balance_total += td.amount();
if (is_transfer_unlocked(td))

View file

@ -369,6 +369,7 @@ namespace tools
uint64_t amount() const { return m_ptx_wallet_info->m_tx.vout[m_internal_output_index].amount; }
bool is_spent() const { return m_flags & WALLET_TRANSFER_DETAIL_FLAG_SPENT; }
bool is_spendable() const { return (m_flags & (~WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER)) == 0; } // spenable = has no flags or mined flag only
bool is_reserved_for_escrow() const { return ( (m_flags & WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION) != 0 ); }
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, tools::wallet2::transform_ptr_to_value, tools::wallet2::transform_value_to_ptr)