Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Mar 1, 2024
1 parent eb35d43 commit e5652f9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/types/access_list_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type AccessListTx struct {
}

// copy creates a deep copy of the transaction data and initializes all fields.
func (tx AccessListTx) copy() *AccessListTx {
func (tx *AccessListTx) copy() *AccessListTx {
cpy := &AccessListTx{
LegacyTx: LegacyTx{
CommonTx: CommonTx{
Expand Down Expand Up @@ -78,11 +78,11 @@ func (tx AccessListTx) copy() *AccessListTx {
return cpy
}

func (tx AccessListTx) GetAccessList() types2.AccessList {
func (tx *AccessListTx) GetAccessList() types2.AccessList {
return tx.AccessList
}

func (tx AccessListTx) Protected() bool {
func (tx *AccessListTx) Protected() bool {
return true
}

Expand All @@ -91,14 +91,14 @@ func (tx *AccessListTx) Unwrap() Transaction {
}

// EncodingSize returns the RLP encoding size of the whole transaction envelope
func (tx AccessListTx) EncodingSize() int {
func (tx *AccessListTx) EncodingSize() int {
payloadSize, _, _, _ := tx.payloadSize()
// Add envelope size and type size
return 1 + rlp2.ListPrefixLen(payloadSize) + payloadSize
}

// payloadSize calculates the RLP encoding size of transaction, without TxType and envelope
func (tx AccessListTx) payloadSize() (payloadSize int, nonceLen, gasLen, accessListLen int) {
func (tx *AccessListTx) payloadSize() (payloadSize int, nonceLen, gasLen, accessListLen int) {
// size of ChainID
payloadSize++
payloadSize += rlp.Uint256LenExcludingHead(tx.ChainID)
Expand Down Expand Up @@ -203,7 +203,7 @@ func EncodeStructSizePrefix(size int, w io.Writer, b []byte) error {
// MarshalBinary returns the canonical encoding of the transaction.
// For legacy transactions, it returns the RLP encoding. For EIP-2718 typed
// transactions, it returns the type and payload.
func (tx AccessListTx) MarshalBinary(w io.Writer) error {
func (tx *AccessListTx) MarshalBinary(w io.Writer) error {
payloadSize, nonceLen, gasLen, accessListLen := tx.payloadSize()
var b [33]byte
// encode TxType
Expand All @@ -217,7 +217,7 @@ func (tx AccessListTx) MarshalBinary(w io.Writer) error {
return nil
}

func (tx AccessListTx) encodePayload(w io.Writer, b []byte, payloadSize, nonceLen, gasLen, accessListLen int) error {
func (tx *AccessListTx) encodePayload(w io.Writer, b []byte, payloadSize, nonceLen, gasLen, accessListLen int) error {
// prefix
if err := EncodeStructSizePrefix(payloadSize, w, b); err != nil {
return err
Expand Down Expand Up @@ -285,7 +285,7 @@ func (tx AccessListTx) encodePayload(w io.Writer, b []byte, payloadSize, nonceLe
}

// EncodeRLP implements rlp.Encoder
func (tx AccessListTx) EncodeRLP(w io.Writer) error {
func (tx *AccessListTx) EncodeRLP(w io.Writer) error {
payloadSize, nonceLen, gasLen, accessListLen := tx.payloadSize()
// size of struct prefix and TxType
envelopeSize := 1 + rlp2.ListPrefixLen(payloadSize) + payloadSize
Expand Down Expand Up @@ -417,7 +417,7 @@ func (tx *AccessListTx) DecodeRLP(s *rlp.Stream) error {
}

// AsMessage returns the transaction as a core.Message.
func (tx AccessListTx) AsMessage(s Signer, _ *big.Int, rules *chain.Rules) (Message, error) {
func (tx *AccessListTx) AsMessage(s Signer, _ *big.Int, rules *chain.Rules) (Message, error) {
msg := Message{
nonce: tx.Nonce,
gasLimit: tx.Gas,
Expand Down

0 comments on commit e5652f9

Please sign in to comment.