integration: senders check that snapshots are not nil #3905

This commit is contained in:
Alex Sharov 2022-04-17 09:52:05 +07:00 committed by GitHub
parent 4419c23866
commit f2a9763a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -576,10 +576,14 @@ func stageSenders(db kv.RwDB, ctx context.Context) error {
s := stage(sync, tx, nil, stages.Senders)
log.Info("Stage", "name", s.ID, "progress", s.BlockNumber)
var br *snapshotsync.BlockRetire
snapshots := allSnapshots(chainConfig)
d, err := dir.OpenRw(snapshots.Dir())
if err != nil {
return err
if snapshots != nil {
d, err := dir.OpenRw(snapshots.Dir())
if err != nil {
return err
}
br = snapshotsync.NewBlockRetire(runtime.NumCPU(), tmpdir, snapshots, d, db, nil, nil)
}
pm, err := prune.Get(tx)
@ -587,7 +591,7 @@ func stageSenders(db kv.RwDB, ctx context.Context) error {
return err
}
cfg := stagedsync.StageSendersCfg(db, chainConfig, tmpdir, pm, snapshotsync.NewBlockRetire(runtime.NumCPU(), tmpdir, snapshots, d, db, nil, nil))
cfg := stagedsync.StageSendersCfg(db, chainConfig, tmpdir, pm, br)
if unwind > 0 {
u := sync.NewUnwindState(stages.Senders, s.BlockNumber-unwind, s.BlockNumber)
if err = stagedsync.UnwindSendersStage(u, tx, cfg, ctx); err != nil {