diff options
author | Felix Lange <fjl@twurst.com> | 2017-03-27 17:52:39 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-03-27 19:29:01 +0800 |
commit | aa9a78e4639e8594849be3fa0f92d7f91f67d528 (patch) | |
tree | d1e84875024142fb9535c27cf6aa168c042f279a /core/gen_genesis_account.go | |
parent | 7419d0c38291236ecc4e54b1a905d5cbcbe065a4 (diff) | |
download | go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.gz go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.bz2 go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.lz go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.xz go-tangerine-aa9a78e4639e8594849be3fa0f92d7f91f67d528.tar.zst go-tangerine-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_account.go')
-rw-r--r-- | core/gen_genesis_account.go | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/core/gen_genesis_account.go b/core/gen_genesis_account.go index 2dda122f2..8885603aa 100644 --- a/core/gen_genesis_account.go +++ b/core/gen_genesis_account.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 @@ -12,31 +12,27 @@ import ( "github.com/ethereum/go-ethereum/common/math" ) -func (g *GenesisAccount) MarshalJSON() ([]byte, error) { +func (g GenesisAccount) MarshalJSON() ([]byte, error) { type GenesisAccountJSON struct { - Code hexutil.Bytes `json:"code" optional:"true"` - Storage map[common.Hash]common.Hash `json:"storage" optional:"true"` + Code hexutil.Bytes `json:"code,omitempty" optional:"true"` + Storage map[common.Hash]common.Hash `json:"storage,omitempty" optional:"true"` Balance *math.HexOrDecimal256 `json:"balance"` - Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` + Nonce math.HexOrDecimal64 `json:"nonce,omitempty" optional:"true"` } var enc GenesisAccountJSON - if g.Code != nil { - enc.Code = g.Code - } - if g.Storage != nil { - enc.Storage = g.Storage - } + enc.Code = g.Code + enc.Storage = g.Storage enc.Balance = (*math.HexOrDecimal256)(g.Balance) - enc.Nonce = (*math.HexOrDecimal64)(&g.Nonce) + enc.Nonce = math.HexOrDecimal64(g.Nonce) return json.Marshal(&enc) } func (g *GenesisAccount) UnmarshalJSON(input []byte) error { type GenesisAccountJSON struct { - Code hexutil.Bytes `json:"code" optional:"true"` - Storage map[common.Hash]common.Hash `json:"storage" optional:"true"` + Code hexutil.Bytes `json:"code,omitempty" optional:"true"` + Storage map[common.Hash]common.Hash `json:"storage,omitempty" optional:"true"` Balance *math.HexOrDecimal256 `json:"balance"` - Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` + Nonce *math.HexOrDecimal64 `json:"nonce,omitempty" optional:"true"` } var dec GenesisAccountJSON if err := json.Unmarshal(input, &dec); err != nil { |