mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
update stage progress before commit - to keep db always consistent (#1888)
This commit is contained in:
parent
49225f7319
commit
b1dc618b95
@ -159,6 +159,9 @@ func BodiesForward(
|
||||
return err
|
||||
}
|
||||
if !useExternalTx {
|
||||
if err := s.DoneAndUpdate(tx, bodyProgress); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tx.CommitAndBegin(context.Background()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -212,15 +212,15 @@ func SpawnExecuteBlocksStage(s *StageState, stateDB ethdb.Database, toBlock uint
|
||||
|
||||
updateProgress := !useBatch || batch.BatchSize() >= int(params.batchSize)
|
||||
if updateProgress {
|
||||
if err = s.Update(tx, stageProgress); err != nil {
|
||||
return err
|
||||
}
|
||||
if useBatch {
|
||||
if err = batch.CommitAndBegin(context.Background()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if !useExternalTx {
|
||||
if err = s.Update(tx, stageProgress); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tx.CommitAndBegin(context.Background()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -152,6 +152,9 @@ func HeadersForward(
|
||||
return err
|
||||
}
|
||||
if !useExternalTx {
|
||||
if err = s.Update(tx, headerInserter.GetHighest()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tx.CommitAndBegin(context.Background()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user