1
0
Fork 0
forked from lthn/blockchain

wallet: fixed a bug when a freshly created wallet's node is in then-become alt-chain (credits to @cryptozoidberg)

This commit is contained in:
sowle 2025-01-31 17:28:28 +01:00
parent 467fd4b6ba
commit 8fc70f4d6d
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 7 additions and 1 deletions

View file

@ -2116,6 +2116,12 @@ void wallet2::handle_pulled_blocks(size_t& blocks_added, std::atomic<bool>& stop
}
else
{
//if first synchronized block in the wallet accidently became orphaned we need to force wallet to resync
if(this->m_minimum_height == height)
{
full_reset_needed = true;
}
//this should happen ONLY after block been matched, if not then is internal error
if (full_reset_needed)
{

View file

@ -217,7 +217,7 @@ void wallet_chain_shortener::check_if_block_matched(uint64_t i, const crypto::ha
}
return;
}
if (!m_last_20_blocks.empty() && i > m_last_20_blocks.begin()->first)
if (!m_last_20_blocks.empty() && i >= m_last_20_blocks.begin()->first)
{
//must be in short sequence (m_last_20_blocks)
//self check