Skip to content

Commit 672ebbc

Browse files
committed
fix spamoor client selection
1 parent a8b9c80 commit 672ebbc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/txmgr/spamoor.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/ecdsa"
66
"errors"
77
"fmt"
8+
"sync/atomic"
89
"time"
910

1011
"github.com/ethereum/go-ethereum/common"
@@ -20,6 +21,7 @@ type Spamoor struct {
2021
clientPool *spamoor.ClientPool
2122
txpool *spamoor.TxPool
2223
clients map[*execution.Client]*spamoor.Client
24+
clientIdx atomic.Uint64
2325
}
2426

2527
func NewSpamoor(ctx context.Context, logger logrus.FieldLogger, executionPool *execution.Pool) (*Spamoor, error) {
@@ -143,7 +145,8 @@ func (s *Spamoor) GetTxPool() *spamoor.TxPool {
143145
}
144146

145147
func (s *Spamoor) GetReadyClient() *spamoor.Client {
146-
return s.clientPool.GetClient()
148+
idx := s.clientIdx.Add(1)
149+
return s.clientPool.GetClient(spamoor.WithClientSelectionMode(spamoor.SelectClientByIndex, int(idx%1000000))) //nolint:gosec // bounded before conversion
147150
}
148151

149152
func (s *Spamoor) GetClient(client *execution.Client) *spamoor.Client {

0 commit comments

Comments
 (0)