Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel committed Sep 25, 2023
1 parent 85a23cc commit 732f82d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/ethadapter/geth_rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
connRetryMaxWait = 10 * time.Minute // after this duration, we will stop retrying to connect and return the failure
connRetryInterval = 500 * time.Millisecond
_maxRetryPriceIncreases = 5
_retryPriceMultiplier = 1.2
)

// gethRPCClient implements the EthClient interface and allows connection to a real ethereum node
Expand Down Expand Up @@ -241,7 +242,7 @@ func (e *gethRPCClient) PrepareTransactionToRetry(txData types.TxData, from geth
// it should never happen but to avoid any risk of repeated price increases we cap the possible retry price bumps to 5
retryFloat := math.Max(_maxRetryPriceIncreases, float64(retryNumber))
// we apply a 20% gas price increase for each retry (retrying with similar price gets rejected by mempool)
multiplier := math.Pow(1.2, retryFloat)
multiplier := math.Pow(_retryPriceMultiplier, retryFloat)

gasPriceFloat := new(big.Float).SetInt(gasPrice)
retryPriceFloat := big.NewFloat(0).Mul(gasPriceFloat, big.NewFloat(multiplier))
Expand Down

0 comments on commit 732f82d

Please sign in to comment.