add cooldown

This commit is contained in:
Felipe Andrade 2023-09-06 15:07:17 -07:00
parent c5054ae0c6
commit 4a288db164

@ -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()