diff --git a/eth/stagedsync/stage_execute.go b/eth/stagedsync/stage_execute.go index 52613c93c..f8fc2ed79 100644 --- a/eth/stagedsync/stage_execute.go +++ b/eth/stagedsync/stage_execute.go @@ -280,14 +280,21 @@ func SpawnExecuteBlocksStage(s *StageState, tx ethdb.RwTx, toBlock uint64, quit if err = s.Update(tx, stageProgress); err != nil { return err } + if traceCursor != nil { + traceCursor.Close() + } if err = tx.Commit(); err != nil { return err } - tx, err = cfg.db.BeginRw(context.Background()) if err != nil { return err } + if cfg.writeCallTraces { + if traceCursor, err = tx.RwCursorDupSort(dbutils.CallTraceSet); err != nil { + return fmt.Errorf("%s: failed to create cursor for call traces: %v", logPrefix, err) + } + } } batch = ethdb.NewBatch(tx) } @@ -312,6 +319,9 @@ func SpawnExecuteBlocksStage(s *StageState, tx ethdb.RwTx, toBlock uint64, quit } } if !useExternalTx { + if traceCursor != nil { + traceCursor.Close() + } if err := tx.Commit(); err != nil { return err }