Match consensus sync on high depth uncles as they leave outer PPLNS window, match 2045aae5a8

This commit is contained in:
DataHoarder 2023-04-22 19:03:24 +02:00
parent fa6e17668b
commit c438622558
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -374,10 +374,10 @@ func (c *SideChain) verifyBlock(block *PoolBlock) (verification error, invalid e
// Deep block
//
// Blocks in PPLNS window (m_chainWindowSize) require up to m_chainWindowSize earlier blocks to verify
// If a block is deeper than m_chainWindowSize * 2 - 1 it can't influence blocks in PPLNS window
// If a block is deeper than (m_chainWindowSize - 1) * 2 + UNCLE_BLOCK_DEPTH it can't influence blocks in PPLNS window
// Also, having so many blocks on top of this one means it was verified by the network at some point
// We skip checks in this case to make pruning possible
if block.Depth.Load() >= c.Consensus().ChainWindowSize*2 {
if block.Depth.Load() > ((c.Consensus().ChainWindowSize-1)*2 + UncleBlockDepth) {
log.Printf("[SideChain] block at height = %d, id = %s skipped verification", block.Side.Height, block.SideTemplateId(c.Consensus()))
return nil, nil
}