Skip to content

Commit

Permalink
api: report blockStoreBase in /chain/info
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Jul 10, 2024
1 parent 271b3ce commit 248c4a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/api_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ type ChainInfo struct {
GenesisTime time.Time `json:"genesisTime" format:"date-time" example:"2022-11-17T18:00:57.379551614Z"`
InitialHeight uint32 `json:"initialHeight" example:"5467"`
Height uint32 `json:"height" example:"5467"`
BlockStoreBase uint32 `json:"blockStoreBase" example:"5467"`
Syncing bool `json:"syncing" example:"true"`
Timestamp int64 `json:"blockTimestamp" swaggertype:"string" format:"date-time" example:"2022-11-17T18:00:57.379551614Z"`
TransactionCount uint64 `json:"transactionCount" example:"554"`
Expand Down
6 changes: 6 additions & 0 deletions api/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ func (a *API) chainInfoHandler(_ *apirest.APIdata, ctx *httprouter.HTTPContext)
blockTimesInMs[0] = uint64(a.vocapp.BlockTimeTarget().Milliseconds())
}

blockStoreBase := uint32(0)
if a.vocapp.Node != nil && a.vocapp.Node.BlockStore() != nil {
blockStoreBase = uint32(a.vocapp.Node.BlockStore().Base())
}

data, err := json.Marshal(&ChainInfo{
ID: a.vocapp.ChainID(),
BlockTime: blockTimesInMs,
Expand All @@ -330,6 +335,7 @@ func (a *API) chainInfoHandler(_ *apirest.APIdata, ctx *httprouter.HTTPContext)
VoteCount: voteCount,
GenesisTime: a.vocapp.Genesis().GenesisTime,
InitialHeight: uint32(a.vocapp.Genesis().InitialHeight),
BlockStoreBase: blockStoreBase,
CircuitVersion: circuit.Version(),
MaxCensusSize: maxCensusSize,
NetworkCapacity: networkCapacity,
Expand Down

0 comments on commit 248c4a4

Please sign in to comment.