From 4a288db1645ba04c5755e93b565cebb4f2edc652 Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Wed, 6 Sep 2023 15:07:17 -0700 Subject: [PATCH] add cooldown --- op-ufm/op-ufm/pkg/provider/roundtrip.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/op-ufm/op-ufm/pkg/provider/roundtrip.go b/op-ufm/op-ufm/pkg/provider/roundtrip.go index f404f33..aa443f1 100644 --- a/op-ufm/op-ufm/pkg/provider/roundtrip.go +++ b/op-ufm/op-ufm/pkg/provider/roundtrip.go @@ -58,6 +58,16 @@ func (p *Provider) RoundTrip(ctx context.Context) { // used for actual round trip time (disregard retry time) roundTripStartedAt := time.Now() for { + // sleep until we get a clear to send + for { + coolDown := time.Duration(p.config.SendTransactionCoolDown) - time.Since(p.txPool.LastSend) + if coolDown > 0 { + time.Sleep(coolDown) + } else { + break + } + } + tx := p.createTx(nonce) txHash = tx.Hash()