p2p/discover: improve nodesByDistance.push code (#26019)
This improves readability of function 'push'.
sort.Search(N, ...) will at most return N when no match, so ix should be compared
with N. The previous version would compare ix with N+1 in case an additional item
was appended. No bug resulted from this comparison, but it's not easy to understand
why.
Co-authored-by:
Felix Lange <fjl@twurst.com>
Showing
Please register or sign in to comment