|
|
@ -37,7 +37,7 @@ var ( |
|
|
|
ErrInvalidTxType = errors.New("transaction type not valid in this context") |
|
|
|
ErrInvalidTxType = errors.New("transaction type not valid in this context") |
|
|
|
ErrTxTypeNotSupported = errors.New("transaction type not supported") |
|
|
|
ErrTxTypeNotSupported = errors.New("transaction type not supported") |
|
|
|
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee") |
|
|
|
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee") |
|
|
|
errEmptyTypedTx = errors.New("empty typed transaction bytes") |
|
|
|
errShortTypedTx = errors.New("typed transaction too short") |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Transaction types.
|
|
|
|
// Transaction types.
|
|
|
@ -134,7 +134,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { |
|
|
|
tx.setDecoded(&inner, int(rlp.ListSize(size))) |
|
|
|
tx.setDecoded(&inner, int(rlp.ListSize(size))) |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
return err |
|
|
|
case kind == rlp.String: |
|
|
|
default: |
|
|
|
// It's an EIP-2718 typed TX envelope.
|
|
|
|
// It's an EIP-2718 typed TX envelope.
|
|
|
|
var b []byte |
|
|
|
var b []byte |
|
|
|
if b, err = s.Bytes(); err != nil { |
|
|
|
if b, err = s.Bytes(); err != nil { |
|
|
@ -145,8 +145,6 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { |
|
|
|
tx.setDecoded(inner, len(b)) |
|
|
|
tx.setDecoded(inner, len(b)) |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
return err |
|
|
|
default: |
|
|
|
|
|
|
|
return rlp.ErrExpectedList |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -174,8 +172,8 @@ func (tx *Transaction) UnmarshalBinary(b []byte) error { |
|
|
|
|
|
|
|
|
|
|
|
// decodeTyped decodes a typed transaction from the canonical format.
|
|
|
|
// decodeTyped decodes a typed transaction from the canonical format.
|
|
|
|
func (tx *Transaction) decodeTyped(b []byte) (TxData, error) { |
|
|
|
func (tx *Transaction) decodeTyped(b []byte) (TxData, error) { |
|
|
|
if len(b) == 0 { |
|
|
|
if len(b) <= 1 { |
|
|
|
return nil, errEmptyTypedTx |
|
|
|
return nil, errShortTypedTx |
|
|
|
} |
|
|
|
} |
|
|
|
switch b[0] { |
|
|
|
switch b[0] { |
|
|
|
case AccessListTxType: |
|
|
|
case AccessListTxType: |
|
|
|