Skip to content

Commit

Permalink
Fix block tree cosmetic bugs (#4768)
Browse files Browse the repository at this point in the history
* Fixed
* Merge branch 'master' into check-ready
  • Loading branch information
terencechain committed Feb 6, 2020
1 parent 91b8760 commit 85b379c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion beacon-chain/blockchain/info.go
Expand Up @@ -72,6 +72,12 @@ const template = `<html>

// TreeHandler is a handler to serve /tree page in metrics.
func (s *Service) TreeHandler(w http.ResponseWriter, _ *http.Request) {
if s.headState == nil {
if _, err := w.Write([]byte("Unavailable during initial syncing")); err != nil {
log.WithError(err).Error("Failed to render p2p info page")
}
}

nodes := s.forkChoiceStore.Nodes()

graph := dot.NewGraph(dot.Directed)
Expand All @@ -94,7 +100,8 @@ func (s *Service) TreeHandler(w http.ResponseWriter, _ *http.Request) {
dotN = graph.Node(index).Box().Attr("label", label)
}

if nodes[i].Slot == s.headSlot {
if nodes[i].Slot == s.headSlot &&
nodes[i].BestDescendent == ^uint64(0) {
dotN = dotN.Attr("color", "green")
}

Expand Down

0 comments on commit 85b379c

Please sign in to comment.