Skip to content

Commit 531c0b6

Browse files
authored
fix order of chain statuses in the returned response (#862)
fix order of chain statuses in the returned response (#862)
1 parent e4e9d8c commit 531c0b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

api/service/hostApiService.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewHostService(queryExecutor query.ExecutorInterface, p2pService p2p.Peer2P
4242

4343
func (hs *HostService) GetHostInfo() (*model.HostInfo, error) {
4444
var (
45-
chainStatuses []*model.ChainStatus
45+
chainStatuses = make([]*model.ChainStatus, len(hs.BlockServices))
4646
lastBlock *model.Block
4747
err error
4848
)
@@ -52,11 +52,11 @@ func (hs *HostService) GetHostInfo() (*model.HostInfo, error) {
5252
if lastBlock == nil || err != nil {
5353
continue
5454
}
55-
chainStatuses = append(chainStatuses, &model.ChainStatus{
55+
chainStatuses[chainType] = &model.ChainStatus{
5656
ChainType: chainType,
5757
Height: lastBlock.Height,
5858
LastBlock: lastBlock,
59-
})
59+
}
6060
}
6161

6262
if lastBlock == nil {

0 commit comments

Comments
 (0)