Skip to content

Commit 1deec1a

Browse files
committed
Avoid looking for negative block numbers
1 parent 0595f3d commit 1deec1a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cli/commands/bridge/to-l1.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const searchForArbBlockByTimestamp = async (
2424
let step = 131072
2525
let block = await l2Provider.getBlock('latest')
2626
while (block.timestamp > timestamp) {
27+
while (block.number - step < 0) {
28+
step = Math.round(step / 2)
29+
}
2730
block = await l2Provider.getBlock(block.number - step)
2831
}
2932
while (step > 1 && Math.abs(block.timestamp - timestamp) > BLOCK_SEARCH_THRESHOLD) {

0 commit comments

Comments
 (0)