mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
add eip1559 zero check too
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
9120fa2120
commit
d59298fd7a
2 changed files with 10 additions and 0 deletions
|
|
@ -143,6 +143,9 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
|
|||
eip1559ParamsSet := args.MaxFeePerGas != nil && args.MaxPriorityFeePerGas != nil
|
||||
if args.GasPrice == nil && eip1559ParamsSet {
|
||||
// Sanity check the EIP-1559 fee parameters if present.
|
||||
if args.MaxFeePerGas.ToInt().Sign() == 0 {
|
||||
return errors.New("maxFeePerGas must be non-zero")
|
||||
}
|
||||
if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {
|
||||
return fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,6 +176,13 @@ func TestSetFeeDefaults(t *testing.T) {
|
|||
nil,
|
||||
errors.New("maxFeePerGas (0x7) < maxPriorityFeePerGas (0x2a)"),
|
||||
},
|
||||
{
|
||||
"dynamic fee tx post-London, explicit gas price",
|
||||
true,
|
||||
&TransactionArgs{MaxFeePerGas: zero, MaxPriorityFeePerGas: zero},
|
||||
nil,
|
||||
errors.New("maxFeePerGas must be non-zero"),
|
||||
},
|
||||
|
||||
// Misc
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue