Skip to content

Commit d83e15d

Browse files
committed
minor changes
1 parent 5d59427 commit d83e15d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

sync/sync_tail.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import (
1010
"github.com/celestiaorg/go-header"
1111
)
1212

13-
// TODO:
14-
// * Flush
15-
1613
// subjectiveTail returns the current Tail header.
1714
// Lazily fetching it if it doesn't exist locally or moving it to a different height.
1815
// Moving is done if either parameters are changed or tail moved outside a pruning window.
@@ -84,9 +81,6 @@ func (s *Syncer[H]) subjectiveTail(ctx context.Context, head H) (H, error) {
8481
if err := s.store.Append(ctx, tail); err != nil {
8582
return tail, fmt.Errorf("appending tail header: %w", err)
8683
}
87-
88-
time.Sleep(time.Millisecond * 1000)
89-
// TODO: Flush
9084
}
9185

9286
if err := s.moveTail(ctx, tail); err != nil {
@@ -110,7 +104,7 @@ func (s *Syncer[H]) moveTail(ctx context.Context, new H) error {
110104

111105
switch {
112106
case old.Height() < new.Height():
113-
log.Infof("move tail up from %d to %d, pruning the diff...", old, new)
107+
log.Infof("move tail up from %d to %d, pruning the diff...", old.Height(), new.Height())
114108
err := s.store.DeleteTo(ctx, new.Height())
115109
if err != nil {
116110
return fmt.Errorf(
@@ -120,7 +114,7 @@ func (s *Syncer[H]) moveTail(ctx context.Context, new H) error {
120114
)
121115
}
122116
case old.Height() > new.Height():
123-
log.Infof("move tail down from %d to %d, syncing the diff...", old, new)
117+
log.Infof("move tail down from %d to %d, syncing the diff...", old.Height(), new.Height())
124118

125119
// TODO(@Wondertan): This works but it assumes this code is only run before syncing routine starts.
126120
// If run after, it may race with other in prog syncs.

sync/sync_tail_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func TestSyncer_TailReconfiguration(t *testing.T) {
3434
localStore,
3535
headertest.NewDummySubscriber(),
3636
WithBlockTime(time.Second*6),
37+
WithRecencyThreshold(time.Nanosecond),
3738
)
3839
require.NoError(t, err)
3940

@@ -125,6 +126,7 @@ func TestSyncer_TailInitialization(t *testing.T) {
125126
localStore,
126127
headertest.NewDummySubscriber(),
127128
WithBlockTime(time.Second*6),
129+
WithRecencyThreshold(time.Nanosecond),
128130
test.option,
129131
)
130132
require.NoError(t, err)

0 commit comments

Comments
 (0)