aboutsummaryrefslogtreecommitdiffstats
path: root/core/gen_genesis.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-03-27 17:52:39 +0800
committerFelix Lange <fjl@twurst.com>2017-03-27 19:29:01 +0800
commitaa9a78e4639e8594849be3fa0f92d7f91f67d528 (patch)
treed1e84875024142fb9535c27cf6aa168c042f279a /core/gen_genesis.go
parent7419d0c38291236ecc4e54b1a905d5cbcbe065a4 (diff)
downloaddexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.gz
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.bz2
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.lz
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.xz
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.zst
dexon-aa9a78e4639e8594849be3fa0f92d7f91f67d528.zip
core, core/types: use non-pointer receiver for Marshal* methods
Regenerated with fjl/gencodec@1a75a2161009 Also add ,omitempty to optional GenesisAccount fields.
Diffstat (limited to 'core/gen_genesis.go')
-rw-r--r--core/gen_genesis.go66
1 files changed, 32 insertions, 34 deletions
diff --git a/core/gen_genesis.go b/core/gen_genesis.go
index b5561ba45..eb86567b7 100644
--- a/core/gen_genesis.go
+++ b/core/gen_genesis.go
@@ -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)