Skip to content

Commit

Permalink
upgrade gaslimit to *1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rain-zxn committed Jun 30, 2022
1 parent 4a14ff6 commit ad18e6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Provider interface {
SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
Init(accounts.Account) error
Accounts() []accounts.Account
SignHash(accounts.Account,[]byte) ([]byte, error)
SignHash(accounts.Account, []byte) ([]byte, error)
}

func New(config *Config, sdk *eth.SDK) *Wallet {
Expand Down Expand Up @@ -335,6 +335,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 ad18e6d

Please sign in to comment.