[rpc] add viewID and epoch to RPCMarshalBlock (#3009)

* [rpc] add viewID and epoch to RPCMarshalBlock

* add apt-get update
pull/3101/head
Yishuang Chen 5 years ago committed by GitHub
parent 7f5392df2f
commit 44185906a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Dockerfile
  2. 4
      internal/hmyapi/apiv1/types.go
  3. 4
      internal/hmyapi/apiv2/types.go

@ -16,6 +16,7 @@ ENV LD_LIBRARY_PATH=${BLS_DIR}/lib:${MCL_DIR}/lib
ENV GIMME_GO_VERSION="1.14.1"
ENV PATH="/root/bin:${PATH}"
RUN apt-get update -y
RUN apt install libgmp-dev libssl-dev curl git \
psmisc dnsutils jq make gcc g++ bash tig tree sudo vim \
silversearcher-ag unzip emacs-nox nano bash-completion -y

@ -353,6 +353,8 @@ func newRPCStakingTransaction(tx *types2.StakingTransaction, blockHash common.Ha
// RPCBlock represents a block that will serialize to the RPC representation of a block
type RPCBlock struct {
Number *hexutil.Big `json:"number"`
ViewID *hexutil.Big `json:"viewID"`
Epoch *hexutil.Big `json:"epoch"`
Hash common.Hash `json:"hash"`
ParentHash common.Hash `json:"parentHash"`
Nonce types.BlockNonce `json:"nonce"`
@ -382,6 +384,8 @@ func RPCMarshalBlock(b *types.Block, blockArgs BlockArgs) (map[string]interface{
head := b.Header() // copies the header once
fields := map[string]interface{}{
"number": (*hexutil.Big)(head.Number()),
"viewID": (*hexutil.Big)(head.ViewID()),
"epoch": (*hexutil.Big)(head.Epoch()),
"hash": b.Hash(),
"parentHash": head.ParentHash(),
"nonce": 0, // Remove this because we don't have it in our header

@ -355,6 +355,8 @@ func newRPCStakingTransaction(
// RPCBlock represents a block that will serialize to the RPC representation of a block
type RPCBlock struct {
Number *big.Int `json:"number"`
ViewID *big.Int `json:"viewID"`
Epoch *big.Int `json:"epoch"`
Hash common.Hash `json:"hash"`
ParentHash common.Hash `json:"parentHash"`
Nonce types.BlockNonce `json:"nonce"`
@ -384,6 +386,8 @@ func RPCMarshalBlock(b *types.Block, blockArgs BlockArgs) (map[string]interface{
head := b.Header() // copies the header once
fields := map[string]interface{}{
"number": (*big.Int)(head.Number()),
"viewID": (*big.Int)(head.ViewID()),
"epoch": (*big.Int)(head.Epoch()),
"hash": b.Hash(),
"parentHash": head.ParentHash(),
"nonce": 0, // Remove this because we don't have it in our header

Loading…
Cancel
Save