Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce generalized multi node client #10907

Merged
merged 12 commits into from
Nov 1, 2023
22 changes: 22 additions & 0 deletions common/chains/client/models.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package client
dhaidashenko marked this conversation as resolved.
Show resolved Hide resolved

import (
"fmt"
)

type SendTxReturnCode int

// SendTxReturnCode is a generalized client error that dictates what should be the next action, depending on the RPC error response.
Expand All @@ -15,3 +19,21 @@ const (
ExceedsMaxFee // Attempt's fee was higher than the node's limit and got rejected.
FeeOutOfValidRange // This error is returned when we use a fee price suggested from an RPC, but the network rejects the attempt due to an invalid range(mostly used by L2 chains). Retry by requesting a new suggested fee price.
)

type NodeTier int
jmank88 marked this conversation as resolved.
Show resolved Hide resolved

const (
Primary = NodeTier(iota)
Secondary
)

func (n NodeTier) String() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok that fields of type NodeTier are only used in logging and no other logic depends on it?

switch n {
case Primary:
return "primary"
case Secondary:
return "secondary"
default:
return fmt.Sprintf("NodeTier(%d)", n)
}
}
Loading
Loading