This commit is contained in:
Eduard S
2021-02-08 15:54:00 +01:00
parent 124d2e84f2
commit 10edd5f2c2
6 changed files with 60 additions and 42 deletions

View File

@@ -82,6 +82,9 @@ type Config struct {
// transaction will be resent (reusing the nonce) with a newly
// calculated gas price
EthTxResendTimeout time.Duration
// EthNoReuseNonce disables reusing nonces of pending transactions for
// new replacement transactions
EthNoReuseNonce bool
// MaxGasPrice is the maximum gas price allowed for ethereum
// transactions
MaxGasPrice *big.Int

View File

@@ -499,7 +499,8 @@ func (t *TxManager) Run(ctx context.Context) {
continue
}
now := time.Now()
if confirm == nil && now.Sub(batchInfo.SendTimestamp) > t.cfg.EthTxResendTimeout {
if !t.cfg.EthNoReuseNonce && confirm == nil &&
now.Sub(batchInfo.SendTimestamp) > t.cfg.EthTxResendTimeout {
log.Infow("TxManager: forgeBatch tx not been mined timeout, resending",
"tx", batchInfo.EthTx.Hash(), "batch", batchInfo.BatchNum)
if err := t.sendRollupForgeBatch(ctx, batchInfo, true); ctx.Err() != nil {
@@ -573,7 +574,9 @@ func (t *TxManager) removeBadBatchInfos(ctx context.Context) error {
if err != nil {
return err
}
t.accNextNonce = accNonce
if !t.cfg.EthNoReuseNonce {
t.accNextNonce = accNonce
}
return nil
}