tests: fix eip1559 tx on non-eip1559 network (#23054)

This commit is contained in:
Daniel Liu 2024-05-28 10:56:53 +08:00
parent b02922fc53
commit c0a63a5295

View file

@ -19,6 +19,7 @@ package tests
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math/big"
"strings"
@ -277,6 +278,9 @@ func (tx *stTransaction) toMessage(ps stPostState, number *big.Int, baseFee *big
gasPrice = math.BigMin(new(big.Int).Add(tx.MaxPriorityFeePerGas, baseFee),
tx.MaxFeePerGas)
}
if gasPrice == nil {
return nil, errors.New("no gas price provided")
}
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, tx.MaxFeePerGas, tx.MaxPriorityFeePerGas, data, accessList, true, nil, number)
return msg, nil