diff --git a/cmd/solana_exporter/slots.go b/cmd/solana_exporter/slots.go index 8eb4f51..77017a1 100644 --- a/cmd/solana_exporter/slots.go +++ b/cmd/solana_exporter/slots.go @@ -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 } diff --git a/pkg/rpc/errors.go b/pkg/rpc/errors.go new file mode 100644 index 0000000..5e3fb9f --- /dev/null +++ b/pkg/rpc/errors.go @@ -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 +)