-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indicate the current index when waiting to reach tip for check:construction
#370
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, 0, nil | ||
} | ||
|
||
return -1, nil | ||
return -1, blockIdentifier.Index, nil | ||
} | ||
|
||
// waitForTip loops until the Rosetta implementation is at tip. | ||
|
@@ -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) | ||
} | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not mistaken |
||
|
||
select { | ||
case <-ctx.Done(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line be
return blockIdentifier.Index, blockIdentifier.Index, nil
? If the chain is at tip, I think it makes more sense thecurrent index == tip index
instead ofcurrent index == 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that work too.