move tx type detection check

This commit is contained in:
Sina Mahmoodi 2024-01-15 16:11:24 +03:30
parent 1a28a17b66
commit 115117c682
2 changed files with 5 additions and 8 deletions

View file

@ -167,12 +167,7 @@ func (mc *multicall) execute(ctx context.Context, opts mcOpts) ([]mcBlockResult,
if err := mc.sanitizeCall(&call, state, &gasUsed, blockContext); err != nil { if err := mc.sanitizeCall(&call, state, &gasUsed, blockContext); err != nil {
return nil, err return nil, err
} }
// Default to dynamic-fee transaction type. tx := call.ToTransaction()
type2 := true
if call.GasPrice != nil {
type2 = false
}
tx := call.ToTransaction(type2)
txes[i] = tx txes[i] = tx
// TODO: repair log block hashes post execution. // TODO: repair log block hashes post execution.
vmConfig := &vm.Config{ vmConfig := &vm.Config{

View file

@ -366,7 +366,9 @@ func (args *TransactionArgs) toTransaction(type2 bool) *types.Transaction {
} }
// ToTransaction converts the arguments to a transaction. // ToTransaction converts the arguments to a transaction.
// It defaults to a dynamic fee transaction unless legacy gas price
// is explicitly provided.
// This assumes that setDefaults has been called. // This assumes that setDefaults has been called.
func (args *TransactionArgs) ToTransaction(type2 bool) *types.Transaction { func (args *TransactionArgs) ToTransaction() *types.Transaction {
return args.toTransaction(type2) return args.toTransaction(args.GasPrice == nil)
} }