From 375e9fd9904898f9e88e2000113832d787ec6e7f Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 2 May 2019 18:46:24 +0200 Subject: [PATCH] wallet2: take escrow-blocked coins into account when calculating the total balance --- src/wallet/wallet2.cpp | 2 +- src/wallet/wallet2.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index eea42ddd..940d90e7 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -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)) diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 916decdc..be33c39f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -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)