forked from lthn/blockchain
wallet2: clear_transfers_from_flag made exception-free (it's often being called from a catch-clause)
This commit is contained in:
parent
6a8315364a
commit
6b415b2d2c
2 changed files with 9 additions and 3 deletions
|
|
@ -3692,16 +3692,22 @@ void wallet2::mark_transfers_with_flag(const std::vector<uint64_t>& selected_tra
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::clear_transfers_from_flag(const std::vector<uint64_t>& selected_transfers, uint32_t flag, const std::string& reason /* = empty_string */)
|
||||
void wallet2::clear_transfers_from_flag(const std::vector<uint64_t>& selected_transfers, uint32_t flag, const std::string& reason /* = empty_string */) noexcept
|
||||
{
|
||||
TRY_ENTRY();
|
||||
for (uint64_t i : selected_transfers)
|
||||
{
|
||||
THROW_IF_TRUE_WALLET_EX(i >= m_transfers.size(), error::wallet_internal_error, "i >= m_transfers.size()");
|
||||
if (i >= m_transfers.size())
|
||||
{
|
||||
WLT_LOG_ERROR("INTERNAL ERROR: i: " << i << " >= m_transfers.size() : " << m_transfers.size());
|
||||
continue;
|
||||
}
|
||||
uint32_t flags_before = m_transfers[i].m_flags;
|
||||
m_transfers[i].m_flags &= ~flag;
|
||||
WLT_LOG_L1("clearing transfer #" << std::setfill('0') << std::right << std::setw(3) << i << " from flag " << flag << " : " << flags_before << " -> " << m_transfers[i].m_flags <<
|
||||
(reason.empty() ? "" : ", reason: ") << reason);
|
||||
}
|
||||
CATCH_ENTRY_NO_RETURN();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::exception_handler()
|
||||
|
|
|
|||
|
|
@ -853,7 +853,7 @@ private:
|
|||
const std::vector<uint64_t>& selected_indicies);
|
||||
void mark_transfers_as_spent(const std::vector<uint64_t>& selected_transfers, const std::string& reason = std::string());
|
||||
void mark_transfers_with_flag(const std::vector<uint64_t>& selected_transfers, uint32_t flag, const std::string& reason = std::string(), bool throw_if_flag_already_set = false);
|
||||
void clear_transfers_from_flag(const std::vector<uint64_t>& selected_transfers, uint32_t flag, const std::string& reason = std::string());
|
||||
void clear_transfers_from_flag(const std::vector<uint64_t>& selected_transfers, uint32_t flag, const std::string& reason = std::string()) noexcept;
|
||||
void exception_handler();
|
||||
void exception_handler() const;
|
||||
uint64_t get_minimum_allowed_fee_for_contract(const crypto::hash& ms_id);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue