From 2453b380866056670039e223bad933ee80caf2bc Mon Sep 17 00:00:00 2001 From: rllola Date: Thu, 13 Oct 2022 11:22:26 +0200 Subject: [PATCH 1/2] message now indicate current index when waiting for it to reach the tip --- pkg/tester/construction.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/tester/construction.go b/pkg/tester/construction.go index 90e6701d..8f59c74c 100644 --- a/pkg/tester/construction.go +++ b/pkg/tester/construction.go @@ -368,7 +368,7 @@ 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, @@ -376,14 +376,14 @@ func (t *ConstructionTester) checkTip(ctx context.Context) (int64, error) { 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) select { case <-ctx.Done(): From 6ebf800cbd92486ce2e5a0d03131db3169e75386 Mon Sep 17 00:00:00 2001 From: rllola Date: Tue, 15 Nov 2022 17:51:16 +0100 Subject: [PATCH 2/2] return block index instead of 0 when we have reached for the tip --- pkg/tester/construction.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tester/construction.go b/pkg/tester/construction.go index 8f59c74c..a70d28c7 100644 --- a/pkg/tester/construction.go +++ b/pkg/tester/construction.go @@ -380,7 +380,7 @@ func (t *ConstructionTester) checkTip(ctx context.Context) (int64, int64, error) } if atTip { - return blockIdentifier.Index, 0, nil + return blockIdentifier.Index, blockIdentifier.Index, nil } return -1, blockIdentifier.Index, nil