diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-26 10:28:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | db0d065425da1e649381eefc33a05b5217a0f2b1 (patch) | |
tree | 7e23466da15c468600a8bca58bf177fc61a3ebf7 | |
parent | bb77ebf738dbc9937eb289092a30c0a785ccd515 (diff) | |
download | dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar.gz dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar.bz2 dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar.lz dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar.xz dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.tar.zst dexon-db0d065425da1e649381eefc33a05b5217a0f2b1.zip |
dex: return round in get block rpc output
-rw-r--r-- | core/types/block.go | 1 | ||||
-rw-r--r-- | core/types/gen_header_json.go | 8 | ||||
-rw-r--r-- | internal/ethapi/api.go | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/core/types/block.go b/core/types/block.go index 4b5e15101..987a30bb7 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") } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 557e0eb3c..12a8316b7 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -886,6 +886,7 @@ func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]inter "transactionsRoot": head.TxHash, "receiptsRoot": head.ReceiptHash, "randomness": hexutil.Bytes(head.Randomness), + "round": hexutil.Uint64(head.Round), "dexconMeta": hexutil.Bytes(head.DexconMeta), } |