diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-26 10:28:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e (patch) | |
tree | e90d8ba6704129856575338a954d121ab87010e2 /core | |
parent | f1efcb07ec8083f832e65bf35d8d687214f095d4 (diff) | |
download | dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar.gz dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar.bz2 dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar.lz dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar.xz dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.tar.zst dexon-061b01e5cfebe19b9fbea31c6a5c8dbd1c1c368e.zip |
dex: return round in get block rpc output
Diffstat (limited to 'core')
-rw-r--r-- | core/types/block.go | 1 | ||||
-rw-r--r-- | core/types/gen_header_json.go | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/types/block.go b/core/types/block.go index da127a9a7..4a0135bdc 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -105,6 +105,7 @@ type headerMarshaling struct { Time *hexutil.Big Extra hexutil.Bytes Randomness hexutil.Bytes + Round hexutil.Uint64 DexconMeta hexutil.Bytes Hash common.Hash `json:"hash"` // adds call to Hash() in MarshalJSON } diff --git a/core/types/gen_header_json.go b/core/types/gen_header_json.go index fd4a91495..74694a38e 100644 --- a/core/types/gen_header_json.go +++ b/core/types/gen_header_json.go @@ -34,7 +34,7 @@ func (h Header) MarshalJSON() ([]byte, error) { Nonce BlockNonce `json:"nonce"` Randomness hexutil.Bytes `json:"randomness" gencodec:"required"` Position types.Position `json:"position" gencodec:"required"` - Round uint64 `json:"round" gencodec:"required"` + Round hexutil.Uint64 `json:"round" gencodec:"required"` DexconMeta hexutil.Bytes `json:"dexconMeta" gencodec:"required"` Hash common.Hash `json:"hash"` } @@ -56,7 +56,7 @@ func (h Header) MarshalJSON() ([]byte, error) { enc.Nonce = h.Nonce enc.Randomness = h.Randomness enc.Position = h.Position - enc.Round = h.Round + enc.Round = hexutil.Uint64(h.Round) enc.DexconMeta = h.DexconMeta enc.Hash = h.Hash() return json.Marshal(&enc) @@ -82,7 +82,7 @@ func (h *Header) UnmarshalJSON(input []byte) error { Nonce *BlockNonce `json:"nonce"` Randomness *hexutil.Bytes `json:"randomness" gencodec:"required"` Position *types.Position `json:"position" gencodec:"required"` - Round *uint64 `json:"round" gencodec:"required"` + Round *hexutil.Uint64 `json:"round" gencodec:"required"` DexconMeta *hexutil.Bytes `json:"dexconMeta" gencodec:"required"` } var dec Header @@ -158,7 +158,7 @@ func (h *Header) UnmarshalJSON(input []byte) error { if dec.Round == nil { return errors.New("missing required field 'round' for Header") } - h.Round = *dec.Round + h.Round = uint64(*dec.Round) if dec.DexconMeta == nil { return errors.New("missing required field 'dexconMeta' for Header") } |