Fixed pruning logic

- Erase an element from m_blocksByHeight only if it's empty
- Remove blocks from unconnected alternative chains too when they get old enough (4xPPLNS window)
This commit is contained in:
SChernykh
2021-08-24 18:34:28 +02:00
parent d4388bf9c0
commit e4be4c1a66
4 changed files with 38 additions and 17 deletions

View File

@@ -52,6 +52,7 @@ PoolBlock::PoolBlock()
, m_invalid(false)
, m_broadcasted(false)
, m_wantBroadcast(false)
, m_localTimestamp(time(nullptr))
{
uv_mutex_init_checked(&m_lock);
@@ -114,6 +115,8 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
m_broadcasted = b.m_broadcasted;
m_wantBroadcast = b.m_wantBroadcast;
m_localTimestamp = time(nullptr);
if (lock_result == 0) {
uv_mutex_unlock(&b.m_lock);
}