@@ -246,8 +246,9 @@ func readList(filename string) ([]string, error) {
246
246
}
247
247
248
248
// ImportHistory imports Era1 files containing historical block information,
249
- // starting from genesis.
250
- func ImportHistory (chain * core.BlockChain , db ethdb.Database , dir string , network string ) error {
249
+ // starting from genesis. The assumption is held that the provided chain
250
+ // segment in Era1 file should all be canonical and verified.
251
+ func ImportHistory (chain * core.BlockChain , dir string , network string ) error {
251
252
if chain .CurrentSnapBlock ().Number .BitLen () != 0 {
252
253
return errors .New ("history import only supported when starting from genesis" )
253
254
}
@@ -308,11 +309,6 @@ func ImportHistory(chain *core.BlockChain, db ethdb.Database, dir string, networ
308
309
if err != nil {
309
310
return fmt .Errorf ("error reading receipts %d: %w" , it .Number (), err )
310
311
}
311
- if status , err := chain .HeaderChain ().InsertHeaderChain ([]* types.Header {block .Header ()}, start ); err != nil {
312
- return fmt .Errorf ("error inserting header %d: %w" , it .Number (), err )
313
- } else if status != core .CanonStatTy {
314
- return fmt .Errorf ("error inserting header %d, not canon: %v" , it .Number (), status )
315
- }
316
312
if _ , err := chain .InsertReceiptChain ([]* types.Block {block }, []types.Receipts {receipts }, 2 ^ 64 - 1 ); err != nil {
317
313
return fmt .Errorf ("error inserting body %d: %w" , it .Number (), err )
318
314
}
0 commit comments