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

@ -2309,6 +2309,9 @@ Error: %v
// of the header retrieval mechanisms already need to verify nonces, as well as
// because nonces can be verified sparsely, not needing to check each.
func (bc *BlockChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) {
if len(chain) == 0 {
return 0, nil
}
start := time.Now()
if i, err := bc.hc.ValidateHeaderChain(chain, checkFreq); err != nil {
return i, err