Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #825 from hermeznetwork/fix/gasPrice
Browse files Browse the repository at this point in the history
Set a gasprice limit after receive it from external source
  • Loading branch information
ARR552 authored May 20, 2021
2 parents e513d4b + d53eda2 commit ee9a9c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions coordinator/txmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ func (t *TxManager) NewAuth(ctx context.Context, batchInfo *BatchInfo) (*bind.Tr
return nil, tracerr.Wrap(er)
}
}
//If gas price is higher than 2000, probably we are going to get the gasLimit exceed error
const maxGasPrice = 2000
maxGasPriceBig := big.NewInt(maxGasPrice)
if gasPrice.Cmp(maxGasPriceBig) == 1 {
gasPrice = maxGasPriceBig
}
if t.cfg.GasPriceIncPerc != 0 {
inc := new(big.Int).Set(gasPrice)
inc.Mul(inc, new(big.Int).SetInt64(t.cfg.GasPriceIncPerc))
Expand Down

0 comments on commit ee9a9c6

Please sign in to comment.