aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2017-07-17 16:33:13 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-07-17 16:33:13 +0800
commit47359301a24b3682b5bf9bbfae0cf8ae21a9ee62 (patch)
treefbcd20d9c32ce14a8dfb5afb15b80fa8560da040 /core
parent0ff35e170d1b913082313089d13e3e6d5490839b (diff)
downloadgo-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar.gz
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar.bz2
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar.lz
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar.xz
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.tar.zst
go-tangerine-47359301a24b3682b5bf9bbfae0cf8ae21a9ee62.zip
core: blocknumber in genesis as hex (#14812)
Diffstat (limited to 'core')
-rw-r--r--core/gen_genesis.go10
-rw-r--r--core/genesis.go1
2 files changed, 5 insertions, 6 deletions
diff --git a/core/gen_genesis.go b/core/gen_genesis.go
index 1f3b4a8aa..4d75704a6 100644
--- a/core/gen_genesis.go
+++ b/core/gen_genesis.go
@@ -13,8 +13,6 @@ import (
"github.com/ethereum/go-ethereum/params"
)
-var _ = (*genesisSpecMarshaling)(nil)
-
func (g Genesis) MarshalJSON() ([]byte, error) {
type Genesis struct {
Config *params.ChainConfig `json:"config"`
@@ -26,7 +24,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
- Number uint64 `json:"number"`
+ Number math.HexOrDecimal64 `json:"number"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
}
@@ -45,7 +43,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
enc.Alloc[common.UnprefixedAddress(k)] = v
}
}
- enc.Number = g.Number
+ enc.Number = math.HexOrDecimal64(g.Number)
enc.GasUsed = math.HexOrDecimal64(g.GasUsed)
enc.ParentHash = g.ParentHash
return json.Marshal(&enc)
@@ -62,7 +60,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
Mixhash *common.Hash `json:"mixHash"`
Coinbase *common.Address `json:"coinbase"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
- Number *uint64 `json:"number"`
+ Number *math.HexOrDecimal64 `json:"number"`
GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
ParentHash *common.Hash `json:"parentHash"`
}
@@ -104,7 +102,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
g.Alloc[common.Address(k)] = v
}
if dec.Number != nil {
- g.Number = *dec.Number
+ g.Number = uint64(*dec.Number)
}
if dec.GasUsed != nil {
g.GasUsed = uint64(*dec.GasUsed)
diff --git a/core/genesis.go b/core/genesis.go
index a507d522b..fd6ed6115 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -92,6 +92,7 @@ type genesisSpecMarshaling struct {
ExtraData hexutil.Bytes
GasLimit math.HexOrDecimal64
GasUsed math.HexOrDecimal64
+ Number math.HexOrDecimal64
Difficulty *math.HexOrDecimal256
Alloc map[common.UnprefixedAddress]GenesisAccount
}