Skip to content

Commit acce8e4

Browse files
committed
Review feedback
1 parent c9b8166 commit acce8e4

3 files changed

Lines changed: 0 additions & 48 deletions

File tree

block/components.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,6 @@ type Components struct {
3636
errorCh chan error
3737
}
3838

39-
// GetLastState returns the current blockchain state
40-
func (bc *Components) GetLastState() types.State {
41-
if bc.Executor != nil {
42-
return bc.Executor.GetLastState()
43-
}
44-
if bc.Syncer != nil {
45-
return bc.Syncer.GetLastState()
46-
}
47-
return types.State{}
48-
}
49-
5039
// Start starts all components and monitors for critical errors.
5140
// It is blocking and returns when the context is cancelled or an error occurs
5241
func (bc *Components) Start(ctx context.Context) error {

block/internal/executing/executor.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ func (e *Executor) Stop() error {
175175
return nil
176176
}
177177

178-
// GetLastState returns the current state.
179-
func (e *Executor) GetLastState() types.State {
180-
state := e.getLastState()
181-
state.AppHash = bytes.Clone(state.AppHash)
182-
return state
183-
}
184-
185178
// getLastState returns the current state.
186179
// getLastState should never directly mutate.
187180
func (e *Executor) getLastState() types.State {

block/internal/syncing/syncer.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -289,27 +289,6 @@ drainLoop:
289289
return nil
290290
}
291291

292-
// isCatchingUpState returns true if the syncer has pending events or is behind the current raft height
293-
func (s *Syncer) isCatchingUpState() bool {
294-
return len(s.heightInCh) != 0 || func() bool {
295-
currentHeight, err := s.store.Height(s.ctx)
296-
if err != nil {
297-
s.logger.Error().Err(err).Msg("failed to get current height")
298-
return false
299-
}
300-
return s.headerStore.Store().Height() > currentHeight ||
301-
s.dataStore.Store().Height() > currentHeight ||
302-
s.raftRetriever != nil && s.raftRetriever.Height() > currentHeight
303-
}()
304-
}
305-
306-
// GetLastState returns the current state.
307-
func (e *Syncer) GetLastState() types.State {
308-
state := e.getLastState()
309-
state.AppHash = bytes.Clone(state.AppHash)
310-
return state
311-
}
312-
313292
// getLastState returns the current state
314293
func (s *Syncer) getLastState() types.State {
315294
state := s.lastState.Load()
@@ -1239,15 +1218,6 @@ func (s *Syncer) cancelP2PWait(height uint64) {
12391218
}
12401219
}
12411220

1242-
// IsSynced checks if the last block height in the stored state matches the expected height and returns true if they are equal.
1243-
func (s *Syncer) IsSynced(expHeight uint64) bool {
1244-
state, err := s.store.GetState(s.ctx)
1245-
if err != nil {
1246-
return false
1247-
}
1248-
return state.LastBlockHeight == expHeight && !s.isCatchingUpState()
1249-
}
1250-
12511221
// IsSyncedWithRaft checks if the local state is synced with the given raft state, including hash check.
12521222
func (s *Syncer) IsSyncedWithRaft(raftState *raft.RaftBlockState) (int, error) {
12531223
state, err := s.store.GetState(s.ctx)

0 commit comments

Comments
 (0)