ethereum/trinity

Trinity may skip a preferred-peer when running with --enable-experimental-eth1-peer-tracking

cburgdorf opened this issue · 1 comments

What is wrong?

Here is Trinity running with a preferred node and the --enable-experimental-eth1-peer-tracking flag

The log clearly shows Trinity is started with a preferred peer but even after several minutes (and after establishing various connections to different peers) it has not once tried to reach out to our specified peers.

Here's the same without using --enable-experimental-eth1-peer-tracking

https://gist.github.com/cburgdorf/a36a95b321294fe3002d577c2c2e3669

We can see that it reaches out to 172.33.0.2 pretty much immediately.

I think what happened is that my local good peer has ended up on the block list and got filtered out. So I believe there may be two issues:

  1. Why did it end up on that list (if that is true)

  2. How can we make it so that a preferred node can bypass this filter

How can it be fixed

If it really is the skip_filter_fn that causes the preferred_node to be filtered out then I think that could be fixed here.

trinity/p2p/discovery.py

Lines 244 to 250 in c3f7c02

for candidate in self.iter_nodes():
if should_skip_fn(candidate):
skip_count += 1
continue
candidates.append(candidate)
if len(candidates) == max_candidates:
break

It looks like the derived PreferredNodeDiscoveryService should have the power to overrule the skip list if it is trying to skip one of the preferred peers.

Fixed by #2042