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 {
return nil, err
}
// Default to dynamic-fee transaction type.
type2 := true
if call.GasPrice != nil {
type2 = false
}
tx := call.ToTransaction(type2)
tx := call.ToTransaction()
txes[i] = tx
// TODO: repair log block hashes post execution.
vmConfig := &vm.Config{

View file

@ -366,7 +366,9 @@ func (args *TransactionArgs) toTransaction(type2 bool) *types.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.
func (args *TransactionArgs) ToTransaction(type2 bool) *types.Transaction {
return args.toTransaction(type2)
func (args *TransactionArgs) ToTransaction() *types.Transaction {
return args.toTransaction(args.GasPrice == nil)
}