|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
// generated by github.com/fjl/gencodec, do not edit.
|
|
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package core |
|
|
|
|
|
|
|
|
@ -13,31 +13,29 @@ import ( |
|
|
|
|
"github.com/ethereum/go-ethereum/params" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func (g *Genesis) MarshalJSON() ([]byte, error) { |
|
|
|
|
func (g Genesis) MarshalJSON() ([]byte, error) { |
|
|
|
|
type GenesisJSON struct { |
|
|
|
|
ChainConfig *params.ChainConfig `json:"config" optional:"true"` |
|
|
|
|
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` |
|
|
|
|
Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"` |
|
|
|
|
ParentHash *common.Hash `json:"parentHash" optional:"true"` |
|
|
|
|
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` |
|
|
|
|
GasLimit *math.HexOrDecimal64 `json:"gasLimit"` |
|
|
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty"` |
|
|
|
|
Mixhash *common.Hash `json:"mixHash" optional:"true"` |
|
|
|
|
Coinbase *common.Address `json:"coinbase" optional:"true"` |
|
|
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` |
|
|
|
|
Config *params.ChainConfig `json:"config" optional:"true"` |
|
|
|
|
Nonce math.HexOrDecimal64 `json:"nonce" optional:"true"` |
|
|
|
|
Timestamp math.HexOrDecimal64 `json:"timestamp" optional:"true"` |
|
|
|
|
ParentHash common.Hash `json:"parentHash" optional:"true"` |
|
|
|
|
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` |
|
|
|
|
GasLimit math.HexOrDecimal64 `json:"gasLimit"` |
|
|
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty"` |
|
|
|
|
Mixhash common.Hash `json:"mixHash" optional:"true"` |
|
|
|
|
Coinbase common.Address `json:"coinbase" optional:"true"` |
|
|
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` |
|
|
|
|
} |
|
|
|
|
var enc GenesisJSON |
|
|
|
|
enc.ChainConfig = g.Config |
|
|
|
|
enc.Nonce = (*math.HexOrDecimal64)(&g.Nonce) |
|
|
|
|
enc.Timestamp = (*math.HexOrDecimal64)(&g.Timestamp) |
|
|
|
|
enc.ParentHash = &g.ParentHash |
|
|
|
|
if g.ExtraData != nil { |
|
|
|
|
enc.ExtraData = g.ExtraData |
|
|
|
|
} |
|
|
|
|
enc.GasLimit = (*math.HexOrDecimal64)(&g.GasLimit) |
|
|
|
|
enc.Config = g.Config |
|
|
|
|
enc.Nonce = math.HexOrDecimal64(g.Nonce) |
|
|
|
|
enc.Timestamp = math.HexOrDecimal64(g.Timestamp) |
|
|
|
|
enc.ParentHash = g.ParentHash |
|
|
|
|
enc.ExtraData = g.ExtraData |
|
|
|
|
enc.GasLimit = math.HexOrDecimal64(g.GasLimit) |
|
|
|
|
enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty) |
|
|
|
|
enc.Mixhash = &g.Mixhash |
|
|
|
|
enc.Coinbase = &g.Coinbase |
|
|
|
|
enc.Mixhash = g.Mixhash |
|
|
|
|
enc.Coinbase = g.Coinbase |
|
|
|
|
if g.Alloc != nil { |
|
|
|
|
enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc)) |
|
|
|
|
for k, v := range g.Alloc { |
|
|
|
@ -49,24 +47,24 @@ func (g *Genesis) MarshalJSON() ([]byte, error) { |
|
|
|
|
|
|
|
|
|
func (g *Genesis) UnmarshalJSON(input []byte) error { |
|
|
|
|
type GenesisJSON struct { |
|
|
|
|
ChainConfig *params.ChainConfig `json:"config" optional:"true"` |
|
|
|
|
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` |
|
|
|
|
Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"` |
|
|
|
|
ParentHash *common.Hash `json:"parentHash" optional:"true"` |
|
|
|
|
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` |
|
|
|
|
GasLimit *math.HexOrDecimal64 `json:"gasLimit"` |
|
|
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty"` |
|
|
|
|
Mixhash *common.Hash `json:"mixHash" optional:"true"` |
|
|
|
|
Coinbase *common.Address `json:"coinbase" optional:"true"` |
|
|
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` |
|
|
|
|
Config *params.ChainConfig `json:"config" optional:"true"` |
|
|
|
|
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` |
|
|
|
|
Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"` |
|
|
|
|
ParentHash *common.Hash `json:"parentHash" optional:"true"` |
|
|
|
|
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` |
|
|
|
|
GasLimit *math.HexOrDecimal64 `json:"gasLimit"` |
|
|
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty"` |
|
|
|
|
Mixhash *common.Hash `json:"mixHash" optional:"true"` |
|
|
|
|
Coinbase *common.Address `json:"coinbase" optional:"true"` |
|
|
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` |
|
|
|
|
} |
|
|
|
|
var dec GenesisJSON |
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
var x Genesis |
|
|
|
|
if dec.ChainConfig != nil { |
|
|
|
|
x.Config = dec.ChainConfig |
|
|
|
|
if dec.Config != nil { |
|
|
|
|
x.Config = dec.Config |
|
|
|
|
} |
|
|
|
|
if dec.Nonce != nil { |
|
|
|
|
x.Nonce = uint64(*dec.Nonce) |
|
|
|
|