Closed Crypt-iQ closed 7 months ago
I guess we can delete the peer address from.the map after it has been disconnected but disconnecting leads to punishment in the current design.
I think it should just get refreshed on a reconnect, some people had problems with connecting to tor since the old ranking was used
Old Ranking? Was there a different ranking before this? Just checked this PR: https://github.com/lightninglabs/neutrino/pull/179 and it seems this current ranking was introduced same time as the work dispatcher.
@Chinwendu20 - he means the rank value
Thanks @ellemouton, we can fix this by deleting the peer from the ranking map when it disconnects, changing the current design. I can work on this but I do not know if the issue needs further triaging.
That would work, but I think just resetting the value to defaultScore in AddPeer is a smaller patch. Maybe not as correct, but still should work
Yeah that sounds great.
Please I have a question about this, why is it important to fetch from this particular peer. If a peer has a bad score and other peers are present they can take on that task otherwise, the workmanager would still schedule the task to the bad scored peer if that peer is the only one on the list or all peers present have same score.
Hmm, I don't remember anymore. @Roasbeef do you think this should be addressed given https://github.com/lightninglabs/neutrino/issues/280#issuecomment-1703914567
. If a peer has a bad score and other peers are present they can take on that task otherwise, the workmanager would still schedule the task to the bad scored peer if that peer is the only one on the list or all peers present have same score.
Yeah @Chinwendu20 is right here imo, as is we still uniformly schedule tasks to all peers when we have a batch. If it's a series of one-off requests, then the highest ranking node will get the task. However if we have a batch of items, due to the way the initial allocation logic is setup, the load will be distributed to all peers.
Making a more specific issue with an implementation plan for improving the state of the art here.
In
peer_rank.go
we never refresh a peer's rank if we reconnect. It will use the old ranking we had for it. If we try to query a tor node and penalize it due to high latency, we should allow reconnecting to refresh the rank: https://github.com/lightninglabs/neutrino/blob/cb61d7f9ff0381415acd88b841f74bfeb4b87e80/query/peer_rank.go#L57-L61