diff --git a/blockdag/blockset.go b/blockdag/blockset.go index 0d9042435..690039b3c 100644 --- a/blockdag/blockset.go +++ b/blockdag/blockset.go @@ -38,7 +38,7 @@ func (bs blockSet) maxHeight() int32 { func (bs blockSet) highest() *blockNode { var highest *blockNode for _, node := range bs { - if highest.height < node.height || daghash.Less(&node.hash, &highest.hash) { + if highest == nil || highest.height < node.height || daghash.Less(&node.hash, &highest.hash) { highest = node } }