eth/downloader: ignore zero size header batch for importing (#24569)

* eth/downloader: ignore zero size header batch for importing

* core, light: reject empty header batch for importing
This commit is contained in:
rjl493456442
2022-03-23 01:58:05 +08:00
committed by GitHub
parent 7ae6c4a790
commit e0e8bf31c5
3 changed files with 23 additions and 15 deletions

View File

@ -419,6 +419,9 @@ func (lc *LightChain) SetChainHead(header *types.Header) error {
// In the case of a light chain, InsertHeaderChain also creates and posts light
// chain events when necessary.
func (lc *LightChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) {
if len(chain) == 0 {
return 0, nil
}
if atomic.LoadInt32(&lc.disableCheckFreq) == 1 {
checkFreq = 0
}