From 85b379c08c6bbaa2cbdc3f0672d737efd87392f1 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Wed, 5 Feb 2020 20:49:12 -0800 Subject: [PATCH] Fix block tree cosmetic bugs (#4768) * Fixed * Merge branch 'master' into check-ready --- beacon-chain/blockchain/info.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/beacon-chain/blockchain/info.go b/beacon-chain/blockchain/info.go index 0c25a48c3..47f439b90 100644 --- a/beacon-chain/blockchain/info.go +++ b/beacon-chain/blockchain/info.go @@ -72,6 +72,12 @@ const template = ` // 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) @@ -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") }