diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 8714f989d6..fcb18baa53 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -470,7 +470,7 @@ func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args Transacti s.nonceLock.LockAddr(args.from()) defer s.nonceLock.UnlockAddr(args.from()) } - if args.BlobVersionedHashes != nil { + if args.IsEIP4844() { return common.Hash{}, errBlobTxNotSupported } signed, err := s.signTransaction(ctx, &args, passwd) @@ -498,8 +498,8 @@ func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args Transacti if args.GasPrice == nil && (args.MaxFeePerGas == nil || args.MaxPriorityFeePerGas == nil) { return nil, errors.New("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas") } - if args.BlobVersionedHashes != nil && args.MaxFeePerBlobGas == nil { - return nil, errors.New("missing maxFeePerBlobGas") + if args.IsEIP4844() && (args.BlobVersionedHashes == nil || args.MaxFeePerBlobGas == nil) { + return nil, errors.New("missing maxFeePerBlobGas or blobVersionedHashes") } if args.Nonce == nil { return nil, errors.New("nonce not specified") @@ -1819,7 +1819,7 @@ func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionAr s.nonceLock.LockAddr(args.from()) defer s.nonceLock.UnlockAddr(args.from()) } - if args.BlobVersionedHashes != nil { + if args.IsEIP4844() { return common.Hash{}, errBlobTxNotSupported } @@ -1906,8 +1906,8 @@ func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionAr if args.GasPrice == nil && (args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil) { return nil, errors.New("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas") } - if args.BlobVersionedHashes != nil && args.MaxFeePerBlobGas == nil { - return nil, errors.New("missing maxFeePerBlobGas") + if args.IsEIP4844() && (args.BlobVersionedHashes == nil || args.MaxFeePerBlobGas == nil) { + return nil, errors.New("missing maxFeePerBlobGas or blobVersionedHashes") } if args.Nonce == nil { return nil, errors.New("nonce not specified") diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 50621a8d1d..1a66c20b40 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -408,3 +408,8 @@ func (args *TransactionArgs) toTransaction() *types.Transaction { func (args *TransactionArgs) ToTransaction() *types.Transaction { return args.toTransaction() } + +// IsEIP4844 returns an indicator if the args contains EIP4844 fields. +func (args *TransactionArgs) IsEIP4844() bool { + return args.BlobVersionedHashes != nil || args.MaxFeePerBlobGas != nil +}