|
|
|
@ -37,7 +37,7 @@ var ( |
|
|
|
|
ErrInvalidTxType = errors.New("transaction type not valid in this context") |
|
|
|
|
ErrTxTypeNotSupported = errors.New("transaction type not supported") |
|
|
|
|
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.
|
|
|
|
@ -134,7 +134,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { |
|
|
|
|
tx.setDecoded(&inner, int(rlp.ListSize(size))) |
|
|
|
|
} |
|
|
|
|
return err |
|
|
|
|
case kind == rlp.String: |
|
|
|
|
default: |
|
|
|
|
// It's an EIP-2718 typed TX envelope.
|
|
|
|
|
var b []byte |
|
|
|
|
if b, err = s.Bytes(); err != nil { |
|
|
|
@ -145,8 +145,6 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { |
|
|
|
|
tx.setDecoded(inner, len(b)) |
|
|
|
|
} |
|
|
|
|
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.
|
|
|
|
|
func (tx *Transaction) decodeTyped(b []byte) (TxData, error) { |
|
|
|
|
if len(b) == 0 { |
|
|
|
|
return nil, errEmptyTypedTx |
|
|
|
|
if len(b) <= 1 { |
|
|
|
|
return nil, errShortTypedTx |
|
|
|
|
} |
|
|
|
|
switch b[0] { |
|
|
|
|
case AccessListTxType: |
|
|
|
|