Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/tester/construction.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,22 +368,22 @@ func (t *ConstructionTester) StartPeriodicLogger(
}
}

func (t *ConstructionTester) checkTip(ctx context.Context) (int64, error) {
func (t *ConstructionTester) checkTip(ctx context.Context) (int64, int64, error) {
atTip, blockIdentifier, err := utils.CheckNetworkTip(
ctx,
t.network,
t.config.TipDelay,
t.onlineFetcher,
)
if err != nil {
return -1, fmt.Errorf("failed to check network tip: %w", err)
return -1, 0, fmt.Errorf("failed to check network tip: %w", err)
}

if atTip {
return blockIdentifier.Index, nil
return blockIdentifier.Index, blockIdentifier.Index, nil
}

return -1, nil
return -1, blockIdentifier.Index, nil
}

// waitForTip loops until the Rosetta implementation is at tip.
Expand All @@ -393,7 +393,7 @@ func (t *ConstructionTester) waitForTip(ctx context.Context) (int64, error) {

for {
// Don't wait any time before first tick if at tip.
tipIndex, err := t.checkTip(ctx)
tipIndex, currentIndex, err := t.checkTip(ctx)
if err != nil {
return -1, fmt.Errorf("failed to check tip: %w", err)
}
Expand All @@ -402,7 +402,7 @@ func (t *ConstructionTester) waitForTip(ctx context.Context) (int64, error) {
return tipIndex, nil
}

log.Println("waiting for implementation to reach tip before testing...")
log.Printf("waiting for implementation to reach tip before testing... (current index: %d, tip delay: %d)\n", currentIndex, t.config.TipDelay)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking if we want to show the current sync status and progress, other than tip delay probably we can also add current block timestamp so that we know how far are we from the tip

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken BlockIdentifier only has the hash and the index. We don't have the timestamp info to show, do we ?


select {
case <-ctx.Done():
Expand Down