Workaround panic in staged sync. (#777)

Fixes #776
This commit is contained in:
Igor Mandrigin 2020-07-23 22:52:25 +02:00 committed by GitHub
parent 5f0da1ef66
commit 9b599b8ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,6 +187,12 @@ func initPm(manager *ProtocolManager, engine consensus.Engine, chainConfig *para
return *headNumber
}
inserter := func(blocks types.Blocks) (int, error) {
// FIXME: Workaround for staged sync, just do no-op
if manager.blockchain == nil || manager.blockchain.CurrentBlock() == nil {
log.Info("Workaround for staged sync: IIIAAAIII")
return 0, err
}
// If sync hasn't reached the checkpoint yet, deny importing weird blocks.
//
// Ideally we would also compare the head block's timestamp and similarly reject