Commit 6ae65dd6 authored by Roberto Bayardo's avatar Roberto Bayardo

fix swapped fee/tip parameters to estimateGas

parent 10425c1a
...@@ -226,8 +226,8 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (* ...@@ -226,8 +226,8 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{ gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{
From: m.cfg.From, From: m.cfg.From,
To: candidate.To, To: candidate.To,
GasFeeCap: gasFeeCap,
GasTipCap: gasTipCap, GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: rawTx.Data, Data: rawTx.Data,
Value: rawTx.Value, Value: rawTx.Value,
}) })
...@@ -535,8 +535,8 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa ...@@ -535,8 +535,8 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{ gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{
From: m.cfg.From, From: m.cfg.From,
To: rawTx.To, To: rawTx.To,
GasFeeCap: bumpedTip, GasTipCap: bumpedTip,
GasTipCap: bumpedFee, GasFeeCap: bumpedFee,
Data: rawTx.Data, Data: rawTx.Data,
}) })
if err != nil { if err != nil {
......
...@@ -211,6 +211,9 @@ func (b *mockBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (ui ...@@ -211,6 +211,9 @@ func (b *mockBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (ui
if b.g.err != nil { if b.g.err != nil {
return 0, b.g.err return 0, b.g.err
} }
if msg.GasFeeCap.Cmp(msg.GasTipCap) < 0 {
return 0, core.ErrTipAboveFeeCap
}
return b.g.basefee().Uint64(), nil return b.g.basefee().Uint64(), nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment