Skip to content

Commit

Permalink
api: hotfix /chain/blocks/{height}
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Aug 28, 2024
1 parent 01330ed commit 2608782
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/api_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ type Block struct {
comettypes.Header `json:"header"`
Hash types.HexBytes `json:"hash" `
TxCount int64 `json:"txCount"`
// Data is not used anymore but kept here for a hotfix
Data comettypes.Data `json:"data"`
}

// BlockList is used to return a paginated list to the client
Expand Down
7 changes: 7 additions & 0 deletions api/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,10 @@ func (a *API) chainBlockByHeightHandler(_ *apirest.APIdata, ctx *httprouter.HTTP
if err != nil {
return ErrIndexerQueryFailed.WithErr(err)
}
dummyTxs := comettypes.Txs{}
for i := int64(0); i < txcount; i++ {
dummyTxs = append(dummyTxs, comettypes.Tx{})
}
block := &Block{
Header: comettypes.Header{
ChainID: idxblock.ChainID,
Expand All @@ -941,6 +945,9 @@ func (a *API) chainBlockByHeightHandler(_ *apirest.APIdata, ctx *httprouter.HTTP
},
Hash: idxblock.Hash,
TxCount: txcount,
Data: comettypes.Data{
Txs: dummyTxs,
},
}
data, err := json.Marshal(block)
if err != nil {
Expand Down

0 comments on commit 2608782

Please sign in to comment.