Skip to content

Commit

Permalink
fix: changed to not start from 0 (#166)
Browse files Browse the repository at this point in the history
* fix: changed to not start from 0

* fix: increased timeout
  • Loading branch information
Mikelle authored Jun 21, 2024
1 parent 5bc56cb commit c80ebad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions oracle/pkg/l1Listener/l1Listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ func (l *L1Listener) watchL1Block(ctx context.Context) error {
ticker := time.NewTicker(checkInterval)
defer ticker.Stop()

currentBlockNo := 0
// TODO: change it to the store to not miss blocks, if oracle is down
currentBlockNo, err := l.l1Client.BlockNumber(ctx)
if err != nil {
l.logger.Error("failed to get block number", "error", err)
return err
}
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -181,7 +186,7 @@ func (l *L1Listener) watchL1Block(ctx context.Context) error {
)
}

currentBlockNo = int(blockNum)
currentBlockNo = blockNum
}
}
}
2 changes: 1 addition & 1 deletion oracle/pkg/l1Listener/l1Listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestL1Listener(t *testing.T) {

// ensure no winner is sent for the previous block
select {
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
t.Fatal("timeout waiting for winner")
case update := <-rec.updates:
if update.blockNum.Int64() != 11 {
Expand Down

0 comments on commit c80ebad

Please sign in to comment.