Commit 5de8206d authored by EvanJRichard's avatar EvanJRichard

Obey your linter! Use a ticker to check waitForBlockTag every half-second.

parent ef3ba4cf
...@@ -121,13 +121,15 @@ func waitForBlockTag(number *big.Int, client *ethclient.Client, timeout time.Dur ...@@ -121,13 +121,15 @@ func waitForBlockTag(number *big.Int, client *ethclient.Client, timeout time.Dur
defer ticker.Stop() defer ticker.Stop()
tagBigInt := big.NewInt(tag.Int64()) tagBigInt := big.NewInt(tag.Int64())
for {
select { // Use a loop to periodically check the block number.
case <-ticker.C: for range ticker.C {
block, _ := client.BlockByNumber(ctx, tagBigInt) block, _ := client.BlockByNumber(ctx, tagBigInt)
if block.NumberU64() >= number.Uint64() { if block != nil && block.NumberU64() >= number.Uint64() {
return client.BlockByNumber(ctx, number) return client.BlockByNumber(ctx, number)
}
} }
} }
// Context deadline exceeded or some other error.
return nil, ctx.Err()
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment