From 5d8d892185e55a29f4ddd350864a0a090db9f32a Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Wed, 6 Sep 2023 15:15:19 -0700 Subject: [PATCH] send mutex --- op-ufm/op-ufm/pkg/provider/roundtrip.go | 3 +++ op-ufm/op-ufm/pkg/provider/tx_pool.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/op-ufm/op-ufm/pkg/provider/roundtrip.go b/op-ufm/op-ufm/pkg/provider/roundtrip.go index 7cd12aa..42b5659 100644 --- a/op-ufm/op-ufm/pkg/provider/roundtrip.go +++ b/op-ufm/op-ufm/pkg/provider/roundtrip.go @@ -34,6 +34,9 @@ func (p *Provider) RoundTrip(ctx context.Context) { return } + p.txPool.ExclusiveSend.Lock() + defer p.txPool.ExclusiveSend.Unlock() + txHash := common.Hash{} attempt := 0 nonce := uint64(0) diff --git a/op-ufm/op-ufm/pkg/provider/tx_pool.go b/op-ufm/op-ufm/pkg/provider/tx_pool.go index ffdd214..2ea5f6a 100644 --- a/op-ufm/op-ufm/pkg/provider/tx_pool.go +++ b/op-ufm/op-ufm/pkg/provider/tx_pool.go @@ -18,6 +18,8 @@ type NetworkTransactionPool struct { // Last time a transaction was sent LastSend time.Time + // Prevents concurrent transaction send + ExclusiveSend sync.Mutex } type TransactionState struct {