Skip to content

Commit

Permalink
Fix header subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalodner committed Oct 12, 2020
1 parent 1a17146 commit a5650f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/arb-validator-core/ethbridge/arbClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ func (c *EthArbClient) subscribeBlockHeadersAfter(ctx context.Context, prevBlock
for {
var blockInfo *ethutils.BlockInfo
fetchErrorCount := 0
targetHeight := new(big.Int).Add(prevBlockId.Height.AsInt(), big.NewInt(1))
for {
var err error
targetHeight := new(big.Int).Add(prevBlockId.Height.AsInt(), big.NewInt(1))
blockInfo, err = c.client.BlockInfoByNumber(ctx, targetHeight)
if err == nil {
if err == nil && (*big.Int)(blockInfo.Number).Cmp(targetHeight) == 0 {
// Got next header
break
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func (c *EthArbClient) subscribeBlockHeadersAfter(ctx context.Context, prevBlock
}

prevBlockId = &common.BlockId{
Height: common.NewTimeBlocks(targetHeight),
Height: common.NewTimeBlocks((*big.Int)(blockInfo.Number)),
HeaderHash: common.NewHashFromEth(blockInfo.Hash),
}
blockIdChan <- arbbridge.MaybeBlockId{BlockId: prevBlockId, Timestamp: new(big.Int).SetUint64(uint64(blockInfo.Time))}
Expand Down

0 comments on commit a5650f6

Please sign in to comment.