Skip to content

Commit

Permalink
fix: Use default gas price in case of invalid value (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKrishna authored Oct 27, 2021
1 parent fa8d34d commit 1cb8737
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helper/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func GenerateAuthObj(client *ethclient.Client, address common.Address, data []by
}

mainChainMaxGasPrice := GetConfig().MainchainMaxGasPrice
// Check if configured or not, Use default in case of invalid value
if mainChainMaxGasPrice <= 0 {
mainChainMaxGasPrice = DefaultMainchainMaxGasPrice
}
if gasprice.Cmp(big.NewInt(mainChainMaxGasPrice)) == 1 {
Logger.Error("Gas price is more than max gas price", "gasprice", gasprice)
err = fmt.Errorf("gas price is more than max_gas_price, gasprice = %v, maxGasPrice = %d", gasprice, mainChainMaxGasPrice)
Expand Down

0 comments on commit 1cb8737

Please sign in to comment.