mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
fix logic
This commit is contained in:
parent
d5658fdd1e
commit
4a2ddc34de
3 changed files with 35 additions and 11 deletions
|
|
@ -35,6 +35,7 @@ var (
|
|||
ErrUnexpectedProtection = errors.New("transaction type does not supported EIP-155 protected signatures")
|
||||
ErrInvalidTxType = errors.New("transaction type not valid in this context")
|
||||
ErrTxTypeNotSupported = errors.New("transaction type not supported")
|
||||
ErrL1MessageTxTypeNotSupported = errors.New("l1 message transaction type not supported")
|
||||
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee")
|
||||
errShortTypedTx = errors.New("typed transaction too short")
|
||||
errInvalidYParity = errors.New("'yParity' field must be 0 or 1")
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
|||
}
|
||||
|
||||
case L1MessageTxType:
|
||||
return nil
|
||||
return ErrL1MessageTxTypeNotSupported
|
||||
|
||||
default:
|
||||
return ErrTxTypeNotSupported
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func (ec *Client) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumb
|
|||
|
||||
type rpcBlock struct {
|
||||
Hash *common.Hash `json:"hash"`
|
||||
Transactions []rpcTransaction `json:"transactions"`
|
||||
Transactions rpcTransactions `json:"transactions"`
|
||||
UncleHashes []common.Hash `json:"uncles"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`
|
||||
}
|
||||
|
|
@ -270,6 +270,29 @@ func (tx *rpcTransaction) UnmarshalJSON(msg []byte) error {
|
|||
return json.Unmarshal(msg, &tx.txExtraInfo)
|
||||
}
|
||||
|
||||
type rpcTransactions []rpcTransaction
|
||||
|
||||
func (txs *rpcTransactions) UnmarshalJSON(msg []byte) error {
|
||||
var rawTxs []json.RawMessage
|
||||
if err := json.Unmarshal(msg, &rawTxs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var parsedTxs []rpcTransaction
|
||||
for _, tx := range rawTxs {
|
||||
var parsedTx rpcTransaction
|
||||
if err := json.Unmarshal(tx, &parsedTx); err != nil {
|
||||
if err == types.ErrL1MessageTxTypeNotSupported {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
parsedTxs = append(parsedTxs, parsedTx)
|
||||
}
|
||||
*txs = parsedTxs
|
||||
return nil
|
||||
}
|
||||
|
||||
// TransactionByHash returns the transaction with the given hash.
|
||||
func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error) {
|
||||
var json *rpcTransaction
|
||||
|
|
|
|||
Loading…
Reference in a new issue