From 248c4a4c90b4eb98204e3f8aa0e122b3709918fb Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Mon, 8 Jul 2024 10:04:15 +0200 Subject: [PATCH] api: report blockStoreBase in /chain/info --- api/api_types.go | 1 + api/chain.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/api/api_types.go b/api/api_types.go index 65f20aa5f..6cdc796ea 100644 --- a/api/api_types.go +++ b/api/api_types.go @@ -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"` diff --git a/api/chain.go b/api/chain.go index a67af1d7a..858d48408 100644 --- a/api/chain.go +++ b/api/chain.go @@ -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, @@ -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,