Skip to content

Commit

Permalink
rpc error code constants
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstonematt committed Oct 14, 2024
1 parent 4f2c927 commit bc96a3e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/solana_exporter/slots.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (c *SlotWatcher) fetchAndEmitSingleFeeReward(
var rpcError *rpc.RPCError
if errors.As(err, &rpcError) {
// this is the error code for slot was skipped:
if rpcError.Code == -32007 && strings.Contains(rpcError.Message, "skipped") {
if rpcError.Code == rpc.SlotSkippedCode && strings.Contains(rpcError.Message, "skipped") {
klog.Infof("slot %v was skipped, no fee rewards.", slot)
return nil
}
Expand Down
23 changes: 23 additions & 0 deletions pkg/rpc/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package rpc

// error codes: https://github.com/anza-xyz/agave/blob/489f483e1d7b30ef114e0123994818b2accfa389/rpc-client-api/src/custom_error.rs#L17
const (
BlockCleanedUpCode = -32001
SendTransactionPreflightFailureCode = -32002
TransactionSignatureVerificationFailureCode = -32003
BlockNotAvailableCode = -32004
NodeUnhealthyCode = -32005
TransactionPrecompileVerificationFailureCode = -32006
SlotSkippedCode = -32007
NoSnapshotCode = -32008
LongTermStorageSlotSkippedCode = -32009
KeyExcludedFromSecondaryIndexCode = -32010
TransactionHistoryNotAvailableCode = -32011
ScanErrorCode = -32012
TransactionSignatureLengthMismatchCode = -32013
BlockStatusNotYetAvailableCode = -32014
UnsupportedTransactionVersionCode = -32015
MinContextSlotNotReachedCode = -32016
EpochRewardsPeriodActiveCode = -32017
SlotNotEpochBoundaryCode = -32018
)

0 comments on commit bc96a3e

Please sign in to comment.