Skip to content

Commit 4ac8f10

Browse files
authored
Merge pull request #4 from Chia-Network/fix-when-syncing
2 parents 9509131 + 6cd5a78 commit 4ac8f10

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/healthcheck/healthcheck.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,26 @@ func (h *Healthcheck) websocketReceive(resp *types.WebsocketResponse, err error)
9999
}
100100

101101
func (h *Healthcheck) fullNodeReceive(resp *types.WebsocketResponse) {
102-
if resp.Command != "block" {
102+
var blockHeight uint32
103+
104+
if resp.Command != "get_blockchain_state" {
103105
return
104106
}
105107

106-
block := &types.BlockEvent{}
108+
block := &types.WebsocketBlockchainState{}
107109
err := json.Unmarshal(resp.Data, block)
108110
if err != nil {
109111
log.Errorf("Error unmarshalling: %s\n", err.Error())
110112
return
111113
}
114+
blockHeight = block.BlockchainState.Peak.OrEmpty().Height
112115

113116
// Edge case, but we should be sure block height is increasing
114-
if block.Height <= h.lastHeight {
117+
if blockHeight <= h.lastHeight {
115118
return
116119
}
117120

118-
h.lastHeight = block.Height
121+
h.lastHeight = blockHeight
119122
h.lastHeightTime = time.Now()
120123
}
121124

0 commit comments

Comments
 (0)