fix bug: connection with DirInbound may not have addresses in Peerstore. #316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connection is filtered out when n.host.Peerstore().Addrs(remotePeerId)) == 0. which is added to fix issue https://github.com/ethstorage/go-ethstorage/issues/72. (related PR: https://github.com/ethstorage/go-ethstorage/pull/91)
However, this fix will additionally filter out some connections that should not be ignored. For example, if a connection is coming in connection (Direction == DirInbound), its address may not have been added to Peerstore yet, at this time, the incoming connection would be ignored. The following are the connections shown when stopping the es-node, but only 29 of them are added to the syncclient.
How to Fix
To ignore the connection without disconnecting which is caused by NAT, this can be done after we get the shard list failure.
After the change, we will get the following error for that case (temporary change its log level from debug to warning to make it more obvious)
Running the change on Sepolia test net before and after the change for 10 minutes, and the connected connections increase from 29 to 40.
Before change:
After change: