1
0
Fork 0
forked from lthn/blockchain

handling of rare but possible situation with wallet sync rewound

This commit is contained in:
cryptozoidberg 2020-05-17 18:50:40 +02:00
parent 30e400b2d0
commit eb119d6a3b
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -1229,10 +1229,19 @@ void wallet2::handle_pulled_blocks(size_t& blocks_added, std::atomic<bool>& stop
//TODO: get_block_hash is slow
crypto::hash bl_id = get_block_hash(bl);
if (processed_blocks_count != 1 && height > processed_blocks_count && height != m_minimum_height)
{//internal error:
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(false,
"height{" << height <<"} > processed_blocks_count{" << processed_blocks_count << "}");
if (processed_blocks_count != 1 && height > processed_blocks_count)
{
if (height != m_minimum_height)
{
//internal error:
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(false,
"height{" << height << "} > processed_blocks_count{" << processed_blocks_count << "}");
}
else
{
//possible case, wallet rewound to m_minimum_height
m_chain.clear();
}
}
else if (height == processed_blocks_count)
{