Commit 6bb4f378 authored by vicotor's avatar vicotor

fix bug

parent 0a8e6898
...@@ -105,13 +105,19 @@ func (s *ChainSync) loop() { ...@@ -105,13 +105,19 @@ func (s *ChainSync) loop() {
continue continue
} }
if latestTime, err := s.d.GetBlockTime(s.chain, latestHeight); err == nil { if beginTime, err := s.d.GetBlockTime(s.chain, beginHeight); err == nil {
blockTime := time.Unix(int64(latestTime), 0) blockTime := time.Unix(int64(beginTime), 0)
if time.Since(blockTime) < time.Minute { if time.Since(blockTime) < time.Minute {
s.syncmode = false s.syncmode = false
} else { } else {
s.syncmode = true s.syncmode = true
} }
log.WithField("chain", s.name).WithFields(log.Fields{
"begin height": beginHeight,
"block time": blockTime,
"sync mode": s.syncmode,
"sinceTime": time.Since(blockTime).String(),
}).Debug("begin block time")
} }
if latestHeight < endHeight { if latestHeight < endHeight {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment