diff options
Diffstat (limited to 'core/gen_genesis_account.go')
-rw-r--r-- | core/gen_genesis_account.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/gen_genesis_account.go b/core/gen_genesis_account.go index 45a03c329..1a5653e4b 100644 --- a/core/gen_genesis_account.go +++ b/core/gen_genesis_account.go @@ -14,12 +14,15 @@ import ( var _ = (*genesisAccountMarshaling)(nil) +// MarshalJSON marshals as JSON. func (g GenesisAccount) MarshalJSON() ([]byte, error) { type GenesisAccount struct { Code hexutil.Bytes `json:"code,omitempty"` Storage map[storageJSON]storageJSON `json:"storage,omitempty"` Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"` Nonce math.HexOrDecimal64 `json:"nonce,omitempty"` + Staked *math.HexOrDecimal256 `json:"staked"` + PublicKey hexutil.Bytes `json:"publicKey"` PrivateKey hexutil.Bytes `json:"secretKey,omitempty"` } var enc GenesisAccount @@ -32,16 +35,21 @@ func (g GenesisAccount) MarshalJSON() ([]byte, error) { } enc.Balance = (*math.HexOrDecimal256)(g.Balance) enc.Nonce = math.HexOrDecimal64(g.Nonce) + enc.Staked = (*math.HexOrDecimal256)(g.Staked) + enc.PublicKey = g.PublicKey enc.PrivateKey = g.PrivateKey return json.Marshal(&enc) } +// UnmarshalJSON unmarshals from JSON. func (g *GenesisAccount) UnmarshalJSON(input []byte) error { type GenesisAccount struct { Code *hexutil.Bytes `json:"code,omitempty"` Storage map[storageJSON]storageJSON `json:"storage,omitempty"` Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"` Nonce *math.HexOrDecimal64 `json:"nonce,omitempty"` + Staked *math.HexOrDecimal256 `json:"staked"` + PublicKey *hexutil.Bytes `json:"publicKey"` PrivateKey *hexutil.Bytes `json:"secretKey,omitempty"` } var dec GenesisAccount @@ -64,6 +72,12 @@ func (g *GenesisAccount) UnmarshalJSON(input []byte) error { if dec.Nonce != nil { g.Nonce = uint64(*dec.Nonce) } + if dec.Staked != nil { + g.Staked = (*big.Int)(dec.Staked) + } + if dec.PublicKey != nil { + g.PublicKey = *dec.PublicKey + } if dec.PrivateKey != nil { g.PrivateKey = *dec.PrivateKey } |