mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
internal/ethapi: handle set code tx type in transaction args
This commit is contained in:
parent
630b42cda8
commit
bebcdd8bc0
1 changed files with 27 additions and 0 deletions
|
|
@ -72,6 +72,9 @@ type TransactionArgs struct {
|
||||||
Commitments []kzg4844.Commitment `json:"commitments"`
|
Commitments []kzg4844.Commitment `json:"commitments"`
|
||||||
Proofs []kzg4844.Proof `json:"proofs"`
|
Proofs []kzg4844.Proof `json:"proofs"`
|
||||||
|
|
||||||
|
// For SetCodeTxType
|
||||||
|
AuthList *types.AuthorizationList `json:"authList"`
|
||||||
|
|
||||||
// This configures whether blobs are allowed to be passed.
|
// This configures whether blobs are allowed to be passed.
|
||||||
blobSidecarAllowed bool
|
blobSidecarAllowed bool
|
||||||
}
|
}
|
||||||
|
|
@ -473,6 +476,8 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoA
|
||||||
func (args *TransactionArgs) ToTransaction(defaultType int) *types.Transaction {
|
func (args *TransactionArgs) ToTransaction(defaultType int) *types.Transaction {
|
||||||
usedType := types.LegacyTxType
|
usedType := types.LegacyTxType
|
||||||
switch {
|
switch {
|
||||||
|
case args.AuthList != nil || defaultType == types.SetCodeTxType:
|
||||||
|
usedType = types.SetCodeTxType
|
||||||
case args.BlobHashes != nil || defaultType == types.BlobTxType:
|
case args.BlobHashes != nil || defaultType == types.BlobTxType:
|
||||||
usedType = types.BlobTxType
|
usedType = types.BlobTxType
|
||||||
case args.MaxFeePerGas != nil || defaultType == types.DynamicFeeTxType:
|
case args.MaxFeePerGas != nil || defaultType == types.DynamicFeeTxType:
|
||||||
|
|
@ -486,6 +491,28 @@ func (args *TransactionArgs) ToTransaction(defaultType int) *types.Transaction {
|
||||||
}
|
}
|
||||||
var data types.TxData
|
var data types.TxData
|
||||||
switch usedType {
|
switch usedType {
|
||||||
|
case types.SetCodeTxType:
|
||||||
|
al := types.AccessList{}
|
||||||
|
if args.AccessList != nil {
|
||||||
|
al = *args.AccessList
|
||||||
|
}
|
||||||
|
authList := types.AuthorizationList{}
|
||||||
|
if args.AuthList != nil {
|
||||||
|
authList = *args.AuthList
|
||||||
|
}
|
||||||
|
data = &types.SetCodeTx{
|
||||||
|
To: *args.To,
|
||||||
|
ChainID: args.ChainID.ToInt().Uint64(),
|
||||||
|
Nonce: uint64(*args.Nonce),
|
||||||
|
Gas: uint64(*args.Gas),
|
||||||
|
GasFeeCap: uint256.MustFromBig((*big.Int)(args.MaxFeePerGas)),
|
||||||
|
GasTipCap: uint256.MustFromBig((*big.Int)(args.MaxPriorityFeePerGas)),
|
||||||
|
Value: uint256.MustFromBig((*big.Int)(args.Value)),
|
||||||
|
Data: args.data(),
|
||||||
|
AccessList: al,
|
||||||
|
AuthList: authList,
|
||||||
|
}
|
||||||
|
|
||||||
case types.BlobTxType:
|
case types.BlobTxType:
|
||||||
al := types.AccessList{}
|
al := types.AccessList{}
|
||||||
if args.AccessList != nil {
|
if args.AccessList != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue