engine_v2: fix potential modulo by zero, close XFN-17 (#1615)

This commit is contained in:
Daniel Liu 2025-10-08 13:21:33 +08:00 committed by benjamin202410
parent 785d51ef5a
commit b882d194ba

View file

@ -217,6 +217,9 @@ func (x *XDPoS_v2) CalculateMissingRounds(chain consensus.ChainReader, header *t
return nil, err
}
masternodes := switchInfo.Masternodes
if len(masternodes) == 0 {
return nil, fmt.Errorf("masternodes is empty in CalculateMissingRounds, number = %v, hash %#x", header.Number, header.Hash())
}
// Loop through from the epoch switch block to the current "header" block
nextHeader := header