internal/ethapi: make ext signer sign legacy (#23274)

This commit is contained in:
Daniel Liu 2024-05-29 18:18:40 +08:00
parent 206175fb43
commit 655fb584b3

View file

@ -80,6 +80,10 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
} }
// After london, default to 1559 unless gasPrice is set // After london, default to 1559 unless gasPrice is set
head := b.CurrentHeader() head := b.CurrentHeader()
// If user specifies both maxPriorityfee and maxFee, then we do not
// need to consult the chain for defaults. It's definitely a London tx.
if args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil {
// In this clause, user left some fields unspecified.
if b.ChainConfig().IsEIP1559(head.Number) && args.GasPrice == nil { if b.ChainConfig().IsEIP1559(head.Number) && args.GasPrice == nil {
if args.MaxPriorityFeePerGas == nil { if args.MaxPriorityFeePerGas == nil {
tip, err := b.SuggestGasTipCap(ctx) tip, err := b.SuggestGasTipCap(ctx)
@ -116,6 +120,7 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
args.GasPrice = (*hexutil.Big)(price) args.GasPrice = (*hexutil.Big)(price)
} }
} }
}
if args.Value == nil { if args.Value == nil {
args.Value = new(hexutil.Big) args.Value = new(hexutil.Big)
} }