We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 88f2839 + 2079734 commit 0544a43Copy full SHA for 0544a43
p2p/discover/table.go
@@ -763,7 +763,7 @@ func (tab *Table) addReplacement(b *bucket, n *Node) {
763
// last entry in the bucket. If 'last' isn't the last entry, it has either been replaced
764
// with someone else or became active.
765
func (tab *Table) replace(b *bucket, last *Node) *Node {
766
- if len(b.entries) >= 0 && b.entries[len(b.entries)-1].ID != last.ID {
+ if len(b.entries) == 0 || b.entries[len(b.entries)-1].ID != last.ID {
767
// Entry has moved, don't replace it.
768
return nil
769
}
0 commit comments