Fix block tree cosmetic bugs (#4768)

* Fixed
* Merge branch 'master' into check-ready
This commit is contained in:
terence tsao 2020-02-05 20:49:12 -08:00 committed by GitHub
parent 91b8760632
commit 85b379c08c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,12 @@ const template = `<html>
// TreeHandler is a handler to serve /tree page in metrics. // TreeHandler is a handler to serve /tree page in metrics.
func (s *Service) TreeHandler(w http.ResponseWriter, _ *http.Request) { 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() nodes := s.forkChoiceStore.Nodes()
graph := dot.NewGraph(dot.Directed) graph := dot.NewGraph(dot.Directed)
@ -94,7 +100,8 @@ func (s *Service) TreeHandler(w http.ResponseWriter, _ *http.Request) {
dotN = graph.Node(index).Box().Attr("label", label) 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") dotN = dotN.Attr("color", "green")
} }