Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
TATAUFO committed Feb 12, 2020
1 parent b472155 commit 2388269
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions node/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,18 @@ func (n *Node) syncMsgFromPeers() {
if lastMsgID == lastMsg.ID() {
break
}
//log.Debug("last message", common.Hash2String(lastMsgID))
//log.Debug("curr message", common.Hash2String(lastMsg.ID()))
lastMsgID = lastMsg.ID()
msgs = append(msgs, resMsg...)
}

for _, msg := range msgs {
if err := n.saveMsg(msg); err != nil {
log.Error(err)
break
if len(msgs) > 0 {
log.Debug("Sync", len(msgs), "message from", common.Hash2String(msgs[0].ID()), "to", common.Hash2String(msgs[len(msgs)-1].ID()))
for _, msg := range msgs {
if err := n.saveMsg(msg); err != nil {
log.Error(err)
break
}
}
}

}
}

Expand Down

0 comments on commit 2388269

Please sign in to comment.