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 GitHub
parent 95f0bd2a4b
commit 8c101cd961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -175,6 +175,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