New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: ensure existing p2p connection is removed before reconnecting #4045
Conversation
`peer_infos` has the most up-to-date info on current nodes, and can't contain duplicates, so we use that instead of maintaining a separate list of peers to connect to.
PRO-857 P2P panic
We have seen this assert panic on sisyphos: "assert!(self.active_connections.insert(account_id, connected_socket).is_none());" This occurred when TomJ started a duplicate engine with the same node and keys as an existing one (i.e. two engines with the same p2p key etc). This panic occured on all the nodes of the network. |
2b3b30e
to
9bf950e
Compare
Codecov Report
@@ Coverage Diff @@
## main #4045 +/- ##
======================================
- Coverage 72% 72% -0%
======================================
Files 369 369
Lines 58782 59322 +540
Branches 58782 59322 +540
======================================
+ Hits 42398 42672 +274
- Misses 14284 14530 +246
- Partials 2100 2120 +20
... and 26 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…4045) * refactor: simplify initial connection to peers `peer_infos` has the most up-to-date info on current nodes, and can't contain duplicates, so we use that instead of maintaining a separate list of peers to connect to. * fix: allow overwriting existing p2p connection * chore: more accurate comment * refactor: send_and_receive helper in p2p tests * chore: use different ports in p2p tests
…4045) * refactor: simplify initial connection to peers `peer_infos` has the most up-to-date info on current nodes, and can't contain duplicates, so we use that instead of maintaining a separate list of peers to connect to. * fix: allow overwriting existing p2p connection * chore: more accurate comment * refactor: send_and_receive helper in p2p tests * chore: use different ports in p2p tests
…4045) * refactor: simplify initial connection to peers `peer_infos` has the most up-to-date info on current nodes, and can't contain duplicates, so we use that instead of maintaining a separate list of peers to connect to. * fix: allow overwriting existing p2p connection * chore: more accurate comment * refactor: send_and_receive helper in p2p tests * chore: use different ports in p2p tests
Pull Request
Closes: PRO-857
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
peer_infos
instead of maintaining a separate list of peers that we delay connecting to;peer_infos
should be more up-to-date and doesn't store duplicates (which could also cause the above panic). Added a unit test to check that this functionality still works.