Skip to content

Commit

Permalink
Merge pull request #33 from rain-zxn/ok
Browse files Browse the repository at this point in the history
upgrade  03v2 gaslimit to *1.1
  • Loading branch information
rain-zxn authored Jun 30, 2022
2 parents 3711240 + 2ec8f9c commit dfa1010
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ func (w *Wallet) EstimateGasWithAccount(account accounts.Account, addr common.Ad
return
}


func (w *Wallet) SendWithMaxLimit(account accounts.Account, addr common.Address, amount *big.Int, maxLimit *big.Int, gasPrice *big.Int, gasPriceX *big.Float, data []byte) (hash string, err error) {
if maxLimit == nil || maxLimit.Sign() <= 0 {
err = fmt.Errorf("max limit is zero or missing")
Expand Down Expand Up @@ -307,6 +306,7 @@ func (w *Wallet) SendWithMaxLimit(account accounts.Account, addr common.Address,
return
}

limit = uint64(1.1 * float32(limit))
if maxLimit.Cmp(new(big.Int).Mul(big.NewInt(int64(limit)), gasPrice)) == -1 {
nonces.Update(false)
err = fmt.Errorf("Send tx estimated gas (limit %v, price %s) higher than max limit %s", limit, gasPrice, maxLimit)
Expand Down

0 comments on commit dfa1010

Please sign in to comment.