1
0
Fork 0
forked from lthn/blockchain

wallet2: fixed add_to_last_zc_global_indexs()

This commit is contained in:
sowle 2024-04-08 18:31:06 +02:00
parent b8cc8818ee
commit 7be8865755
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -504,16 +504,14 @@ void wallet2::add_rollback_event(uint64_t h, const wallet_event_t& ev)
#define M_LAST_ZC_GLOBAL_INDEXS_MAX_SIZE 30
void wallet2::add_to_last_zc_global_indexs(uint64_t h, uint64_t last_zc_output_index)
{
//m_last_zc_global_indexs.remove_if_expiration_less_than(m_last_known_daemon_height - (WALLET_DEFAULT_TX_SPENDABLE_AGE * 2) );
if (m_last_zc_global_indexs.size())
{
if (m_last_zc_global_indexs.begin()->first > h)
if (h > m_last_zc_global_indexs.begin()->first)
{
//new block added on top of last one, simply add new record
m_last_zc_global_indexs.push_front(std::make_pair(h, last_zc_output_index));
}
else if (m_last_zc_global_indexs.begin()->first < h)
else if (h < m_last_zc_global_indexs.begin()->first)
{
//looks like reorganize, pop all records before
while (m_last_zc_global_indexs.size() && m_last_zc_global_indexs.begin()->first >= h)