Skip to content

Commit

Permalink
fix: address negative blockNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 committed Nov 11, 2024
1 parent 44f5c18 commit da8919d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helper/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ func (c *ContractCaller) GetMaticChainBlock(blockNum *big.Int) (header *ethTypes
var latestBlock *ethTypes.Header

if c.MaticGrpcFlag && blockNum != nil {
if blockNum.Sign() < 0 {
blockNum = new(big.Int).Abs(blockNum)
}
latestBlock, err = c.MaticGrpcClient.HeaderByNumber(ctx, blockNum.Uint64())
} else {
latestBlock, err = c.MaticChainClient.HeaderByNumber(ctx, blockNum)
Expand Down

0 comments on commit da8919d

Please sign in to comment.