forked from cerc-io/plugeth
core: make genesis parse baseFee correctly
This commit is contained in:
parent
0e9c7d564d
commit
f763846e6e
@ -30,7 +30,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
|
|||||||
Number math.HexOrDecimal64 `json:"number"`
|
Number math.HexOrDecimal64 `json:"number"`
|
||||||
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
|
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
|
||||||
ParentHash common.Hash `json:"parentHash"`
|
ParentHash common.Hash `json:"parentHash"`
|
||||||
BaseFee *big.Int `json:"baseFee"`
|
BaseFee *math.HexOrDecimal256 `json:"baseFee"`
|
||||||
}
|
}
|
||||||
var enc Genesis
|
var enc Genesis
|
||||||
enc.Config = g.Config
|
enc.Config = g.Config
|
||||||
@ -50,7 +50,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
|
|||||||
enc.Number = math.HexOrDecimal64(g.Number)
|
enc.Number = math.HexOrDecimal64(g.Number)
|
||||||
enc.GasUsed = math.HexOrDecimal64(g.GasUsed)
|
enc.GasUsed = math.HexOrDecimal64(g.GasUsed)
|
||||||
enc.ParentHash = g.ParentHash
|
enc.ParentHash = g.ParentHash
|
||||||
enc.BaseFee = g.BaseFee
|
enc.BaseFee = (*math.HexOrDecimal256)(g.BaseFee)
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
|
|||||||
Number *math.HexOrDecimal64 `json:"number"`
|
Number *math.HexOrDecimal64 `json:"number"`
|
||||||
GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
|
GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
|
||||||
ParentHash *common.Hash `json:"parentHash"`
|
ParentHash *common.Hash `json:"parentHash"`
|
||||||
BaseFee *big.Int `json:"baseFee"`
|
BaseFee *math.HexOrDecimal256 `json:"baseFee"`
|
||||||
}
|
}
|
||||||
var dec Genesis
|
var dec Genesis
|
||||||
if err := json.Unmarshal(input, &dec); err != nil {
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||||||
@ -118,7 +118,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
|
|||||||
g.ParentHash = *dec.ParentHash
|
g.ParentHash = *dec.ParentHash
|
||||||
}
|
}
|
||||||
if dec.BaseFee != nil {
|
if dec.BaseFee != nil {
|
||||||
g.BaseFee = dec.BaseFee
|
g.BaseFee = (*big.Int)(dec.BaseFee)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ type genesisSpecMarshaling struct {
|
|||||||
GasUsed math.HexOrDecimal64
|
GasUsed math.HexOrDecimal64
|
||||||
Number math.HexOrDecimal64
|
Number math.HexOrDecimal64
|
||||||
Difficulty *math.HexOrDecimal256
|
Difficulty *math.HexOrDecimal256
|
||||||
|
BaseFee *math.HexOrDecimal256
|
||||||
Alloc map[common.UnprefixedAddress]GenesisAccount
|
Alloc map[common.UnprefixedAddress]GenesisAccount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user