Skip to content

Commit

Permalink
Merge pull request #32 from rain-zxn/feat_upgrade_o3v2_gaslimit
Browse files Browse the repository at this point in the history
upgrade gaslimit to *1.1
  • Loading branch information
rain-zxn authored Jun 30, 2022
2 parents 4a14ff6 + ad18e6d commit f8165fa
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 f8165fa

Please sign in to comment.