Skip to content

Commit

Permalink
Add a panic in BlockNumber() when retrieval from storage fails
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Jan 6, 2024
1 parent eb14c1e commit df9553c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (api *BlockChainAPI) ChainId() *hexutil.Big {
func (api *BlockChainAPI) BlockNumber() hexutil.Uint64 {
latestBlockHeight, err := api.Store.LatestBlockHeight(context.Background())
if err != nil {
return hexutil.Uint64(0)
// TODO(m-Peter) We should add a logger to BlockChainAPI
panic(fmt.Errorf("failed to fetch the latest block number: %v", err))
}
return hexutil.Uint64(latestBlockHeight)
}
Expand Down

0 comments on commit df9553c

Please sign in to comment.