OSDN Git Service

fix height
authorHAOYUatHZ <haoyu@protonmail.com>
Tue, 27 Aug 2019 12:08:41 +0000 (20:08 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Tue, 27 Aug 2019 12:08:41 +0000 (20:08 +0800)
toolbar/precog/monitor/stats.go

index 2162892..b8b03c6 100644 (file)
@@ -157,7 +157,9 @@ func (m *monitor) processPeerInfo(dbTx *gorm.DB, peerInfo *peers.PeerInfo) error
                }
        }
        ormNodeLiveness.PongTimes += 1
-       ormNodeLiveness.BestHeight = peerInfo.Height
+       if peerInfo.Height != 0 {
+               ormNodeLiveness.BestHeight = peerInfo.Height
+       }
        if err := dbTx.Save(ormNodeLiveness).Error; err != nil {
                return err
        }