diff --git a/common/client/multi_node.go b/common/client/multi_node.go index 87a0c6aed3a..86d971af584 100644 --- a/common/client/multi_node.go +++ b/common/client/multi_node.go @@ -314,11 +314,11 @@ func (c *multiNode[CHAIN_ID, SEQ, ADDR, BLOCK_HASH, TX, TX_HASH, EVENT, EVENT_OP } } + c.activeMu.Lock() if bestNode != c.activeNode { - c.activeMu.Lock() c.activeNode = bestNode - c.activeMu.Unlock() } + c.activeMu.Unlock() } func (c *multiNode[CHAIN_ID, SEQ, ADDR, BLOCK_HASH, TX, TX_HASH, EVENT, EVENT_OPS, TX_RECEIPT, FEE, HEAD, RPC_CLIENT]) checkLeaseLoop() { diff --git a/common/client/node.go b/common/client/node.go index 10e4c9ad643..ef6773fa459 100644 --- a/common/client/node.go +++ b/common/client/node.go @@ -11,6 +11,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/smartcontractkit/chainlink/v2/common/chains/client" "github.com/smartcontractkit/chainlink/v2/common/types" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -133,7 +134,7 @@ func NewNode[ } n.nodeCtx, n.cancelNodeCtx = context.WithCancel(context.Background()) lggr = lggr.Named("Node").With( - "nodeTier", "primary", + "nodeTier", client.Primary.String(), "nodeName", name, "node", n.String(), "chainID", chainID, @@ -147,7 +148,7 @@ func NewNode[ } func (n *node[CHAIN_ID, HEAD, RPC]) String() string { - s := fmt.Sprintf("(primary)%s:%s", n.name, n.ws.String()) + s := fmt.Sprintf("(%s)%s:%s", client.Primary.String(), n.name, n.ws.String()) if n.http != nil { s = s + fmt.Sprintf(":%s", n.http.String()) } diff --git a/common/client/send_only_node.go b/common/client/send_only_node.go index ed74ab0b01a..30e71b96789 100644 --- a/common/client/send_only_node.go +++ b/common/client/send_only_node.go @@ -6,12 +6,13 @@ import ( "net/url" "sync" + "github.com/smartcontractkit/chainlink/v2/common/chains/client" "github.com/smartcontractkit/chainlink/v2/common/types" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) -type SendOnlyClient[ +type sendOnlyClient[ CHAIN_ID types.ID, ] interface { Close() @@ -22,7 +23,7 @@ type SendOnlyClient[ // SendOnlyNode represents one node used as a sendonly type SendOnlyNode[ CHAIN_ID types.ID, - RPC SendOnlyClient[CHAIN_ID], + RPC sendOnlyClient[CHAIN_ID], ] interface { // Start may attempt to connect to the node, but should only return error for misconfiguration - never for temporary errors. Start(context.Context) error @@ -42,7 +43,7 @@ type SendOnlyNode[ // It must use an http(s) url type sendOnlyNode[ CHAIN_ID types.ID, - RPC SendOnlyClient[CHAIN_ID], + RPC sendOnlyClient[CHAIN_ID], ] struct { utils.StartStopOnce @@ -61,7 +62,7 @@ type sendOnlyNode[ // NewSendOnlyNode returns a new sendonly node func NewSendOnlyNode[ CHAIN_ID types.ID, - RPC SendOnlyClient[CHAIN_ID], + RPC sendOnlyClient[CHAIN_ID], ]( lggr logger.Logger, httpuri url.URL, @@ -156,7 +157,7 @@ func (s *sendOnlyNode[CHAIN_ID, RPC]) RPC() RPC { } func (s *sendOnlyNode[CHAIN_ID, RPC]) String() string { - return fmt.Sprintf("(secondary)%s:%s", s.name, s.uri.Redacted()) + return fmt.Sprintf("(%s)%s:%s", client.Secondary.String(), s.name, s.uri.Redacted()) } func (s *sendOnlyNode[CHAIN_ID, RPC]) setState(state nodeState) (changed bool) {