Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eth/peerset.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (ps *peerSet) peerWithHighestJustifiedBlockAndTD() (bestPeer *eth.Peer, bes
continue
}
_, td := p.Head()
if *justified > bestJustified || (*justified == bestJustified && td.Cmp(bestTd) > 0) {
if bestPeer == nil || *justified > bestJustified || (*justified == bestJustified && td.Cmp(bestTd) > 0) {
bestPeer, bestJustified, bestTd = p.Peer, *justified, td
}
}
Expand Down
4 changes: 2 additions & 2 deletions eth/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ func (cs *chainSyncer) nextSyncOp() *chainSyncOp {
if peerJustified < *ourJustified {
return nil
}
// Ignored because justified block height is the same but TD is lower.
if peerJustified == *ourJustified && peerTD.Cmp(ourTD) < 0 {
// Ignored because justified block height is the same but TD is the same or lower.
if peerJustified == *ourJustified && peerTD.Cmp(ourTD) <= 0 {
return nil
}
}
Expand Down