1
0
Fork 0
forked from lthn/blockchain

attempt to fix wallet exception on alt blocks

This commit is contained in:
cryptozoidberg 2024-05-08 01:03:46 +04:00
parent 4c2553a482
commit fd25b5a8e5
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D

View file

@ -522,6 +522,13 @@ void wallet2::add_to_last_zc_global_indexs(uint64_t h, uint64_t last_zc_output_i
}
else
{
//@#@
#ifdef _DEBUG
if (m_last_zc_global_indexs.begin()->second > last_zc_output_index)
{
LOG_ERROR("!!!!!!!!!!!!!!!!!");
}
#endif
//equals, same h but new last_zc_output_index, just update it, should be always bigger then prev
WLT_THROW_IF_FALSE_WITH_CODE(m_last_zc_global_indexs.begin()->second <= last_zc_output_index,
"condition m_last_zc_global_indexs.begin()->second " << m_last_zc_global_indexs.begin()->second << " <= last_zc_output_index " << last_zc_output_index << " failed", API_RETURN_CODE_INTERNAL_ERROR);
@ -3072,6 +3079,12 @@ void wallet2::detach_blockchain(uint64_t including_height)
++it;
}
//detach in m_last_zc_global_indexs
while (m_last_zc_global_indexs.size() && including_height <= m_last_zc_global_indexs.begin()->first )
{
m_last_zc_global_indexs.erase(m_last_zc_global_indexs.begin());
}
//asset descriptors
handle_rollback_events(including_height);