()
| 149 | } |
| 150 | |
| 151 | func (c *Client) GetBlockNumber() *big.Int { |
| 152 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 153 | defer cancel() |
| 154 | |
| 155 | var lastBlock BlockNumber |
| 156 | err := c.c.CallContext(ctx, &lastBlock, "eth_getBlockByNumber", "latest", true) |
| 157 | if err != nil { |
| 158 | log.Error("can't get latest block:", "err", err) |
| 159 | return big.NewInt(0) |
| 160 | } |
| 161 | number, err := strconv.ParseInt(lastBlock.Number, 0, 64) |
| 162 | return big.NewInt(number) |
| 163 | } |
| 164 | |
| 165 | func (c *Client) ChainConfig() (*configs.ChainConfig, error) { |
| 166 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
nothing calls this directly
no test coverage detected