go-ethereum/eth/tracers/native/gen_account_json.go
Sina M f63e9f3a80
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
eth/tracers: fix codehash in prestate diffmode (#34675)
Fixes https://github.com/ethereum/go-ethereum/issues/34648.
2026-04-16 16:51:26 +08:00

62 lines
1.7 KiB
Go

// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package native
import (
"encoding/json"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*accountMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (a account) MarshalJSON() ([]byte, error) {
type account struct {
Balance *hexutil.Big `json:"balance,omitempty"`
Code *hexutil.Bytes `json:"code,omitempty"`
CodeHash *common.Hash `json:"codeHash,omitempty"`
Nonce uint64 `json:"nonce,omitempty"`
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
}
var enc account
enc.Balance = (*hexutil.Big)(a.Balance)
enc.Code = (*hexutil.Bytes)(a.Code)
enc.CodeHash = a.CodeHash
enc.Nonce = a.Nonce
enc.Storage = a.Storage
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (a *account) UnmarshalJSON(input []byte) error {
type account struct {
Balance *hexutil.Big `json:"balance,omitempty"`
Code *hexutil.Bytes `json:"code,omitempty"`
CodeHash *common.Hash `json:"codeHash,omitempty"`
Nonce *uint64 `json:"nonce,omitempty"`
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
}
var dec account
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Balance != nil {
a.Balance = (*big.Int)(dec.Balance)
}
if dec.Code != nil {
a.Code = (*[]byte)(dec.Code)
}
if dec.CodeHash != nil {
a.CodeHash = dec.CodeHash
}
if dec.Nonce != nil {
a.Nonce = *dec.Nonce
}
if dec.Storage != nil {
a.Storage = dec.Storage
}
return nil
}