Skip to content

Commit

Permalink
unified RPC error alert message
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Aug 21, 2024
1 parent 81cff28 commit 3d55b51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions zetaclient/chains/bitcoin/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,19 @@ func CheckRPCStatus(
// query latest block number
bn, err := client.GetBlockCount()
if err != nil {
return errors.Wrap(err, "GetBlockCount error: RPC down?")
return errors.Wrap(err, "RPC error onGetBlockCount: RPC down?")
}

// query latest block header
hash, err := client.GetBlockHash(bn)
if err != nil {
return errors.Wrap(err, "GetBlockHash error: RPC down?")
return errors.Wrap(err, "RPC error onGetBlockHash: RPC down?")
}

// query latest block header thru hash
header, err := client.GetBlockHeader(hash)
if err != nil {
return errors.Wrap(err, "GetBlockHeader error: RPC down?")
return errors.Wrap(err, "RPC error onGetBlockHeader: RPC down?")
}

// use default alert latency if not provided
Expand Down
6 changes: 3 additions & 3 deletions zetaclient/chains/evm/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ func CheckRPCStatus(
// query latest block number
bn, err := client.BlockNumber(ctx)
if err != nil {
return errors.Wrap(err, "BlockNumber error: RPC down?")
return errors.Wrap(err, "RPC error onBlockNumber: RPC down?")
}

// query suggested gas price
gasPrice, err := client.SuggestGasPrice(ctx)
if err != nil {
return errors.Wrap(err, "SuggestGasPrice error: RPC down?")
return errors.Wrap(err, "RPC error onSuggestGasPrice: RPC down?")
}

// query latest block header
header, err := client.HeaderByNumber(ctx, new(big.Int).SetUint64(bn))
if err != nil {
return errors.Wrap(err, "HeaderByNumber error: RPC down?")
return errors.Wrap(err, "RPC error onHeaderByNumber: RPC down?")
}

// use default alert latency if not provided
Expand Down
6 changes: 3 additions & 3 deletions zetaclient/chains/solana/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ func CheckRPCStatus(
// query solana health (always return "ok" unless --trusted-validator is provided)
_, err := client.GetHealth(ctx)
if err != nil {
return errors.Wrap(err, "GetHealth error: RPC down?")
return errors.Wrap(err, "RPC error onGetHealth: RPC down?")
}

// query latest slot
slot, err := client.GetSlot(ctx, rpc.CommitmentFinalized)
if err != nil {
return errors.Wrap(err, "GetSlot error: RPC down?")
return errors.Wrap(err, "RPC error onGetSlot: RPC down?")
}

// query latest block time
blockTime, err := client.GetBlockTime(ctx, slot)
if err != nil {
return errors.Wrap(err, "GetBlockTime error: RPC down?")
return errors.Wrap(err, "RPC error onGetBlockTime: RPC down?")
}

// use default alert latency if not provided
Expand Down

0 comments on commit 3d55b51

Please sign in to comment.