Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
8005a48 to
1158564
Compare
|
Concept ACK, thanks! |
|
there are still some intermittent timeouts, will put in draft until I've fixed them. |
1158564 to
b961ad4
Compare
53457d8 to
0cb0857
Compare
vasild
left a comment
There was a problem hiding this comment.
ACK 0cb08573f38b7aa8a18147eef1a775b6c24bcb7c
I ran test_runner.py and p2p_outbound_management.py a bunch of times locally and did not observe timeouts.
| self.log.info("Advance time") | ||
| self.cur_time += self.MOCKTIME_BUMP | ||
| node.setmocktime(self.cur_time) | ||
| self.generate(node, 1) # Disable stale-tip extra-outbound connections that could interfer |
There was a problem hiding this comment.
Is there an unlikely scenario that a stale-tip extra-outbound connection is initiated after advancing the mocktime and before self.generate(node, 1)? And eventually causing the interference that this is trying to disable?
There was a problem hiding this comment.
I think probably not in practice - CheckForStaleTipAndEvictPeers fires every 45 seconds (on a steady clock, not influenced by the mocktime bump). So I think this means it would only fire if 45 real seconds passed since the last mockscheduler call, which seems very unlikely.
1562496 to
b5e9e38
Compare
b5e9e38 to
c733d11
Compare
mzumsande
left a comment
There was a problem hiding this comment.
Thanks for the review @vasild!
Rebased, addressed feedback, and also added a commit that uses the test-framework auto-outbound mode for p2p_private_broadcast.py, removing some duplicate code.
I just had a rare (?) local intermittent failure of p2p_private_broadcast.py that I need to look into, so I will keep it in draft a little bit longer.
Bortlesboat
left a comment
There was a problem hiding this comment.
ACK c733d11. Ran p2p_outbound_management.py and p2p_private_broadcast.py locally on Ubuntu 24.04, both pass.
c733d11 to
abf8fc4
Compare
|
Concept ACK |
abf8fc4 to
488a980
Compare
|
rebased and overhauled the test, also addressed the outstanding feedback. The main complication is that different types of extra outbound connections on probabilistic timers all use the one available connection slot, so it is a bit hard to handle all constellations. The extra block-relay-only connections are now tested in a separate subtest, and we avoid them in the extra outbound test by using an older tip. That also fixed an intermittent failure seen in the previous CI. one thing I'm not sure about: should the added code in the test framework be put into its own module ( |
This new option allows tests to make use of automatic outbound connections (made from addrman) for the nodes listed in auto_outbound_nodes. A SOCKS5 proxy is used to redirect the connection, by default to a P2PInterface. For advanced customization, tests can provide auto_outbound_factory() to override where each outbound connection made by a node should be redirected to (for example to another node). It is passed the connection type, which is determined by matching the proxy client's address against the nodes' getpeerinfo addrbind. The generic pieces are taken from p2p_private_broadcast.py, which is converted to use them in the next commit. Co-authored-by: Vasil Dimov <[email protected]>
Using the test framework avoids some duplicated code.
The test covers - Extra outbound connections when the tip is stale - Regularly scheduled extra block-relay-only connections - Management of full outbound connection slots with respect to network-specific peers
488a980 to
af6d955
Compare

For #29415, vasild added the possibility to have outbound connections made "naturally" by the node using addrman entries, by redirecting them via a SOCKS5 proxy to python p2ps or other full nodes, so that the node under test behaves as if it is connected to normal non-local peers from arbitrary networks, while we have full control over the peers.
I think this feature is really cool and want to suggest to integrate it more prominently into the test framework ("
auto_outbound_mode") in the first commit because it allows to test the code in which the node decides to make connections - in contrast to the existingadd_outbound_p2p_connectionwhere the functional test intiates the connections.The second commit uses it to add functional test coverage for the following features of outbound connection management:
This should work well with the test from #29415 (which would keep its own
destinations_factorybut can call_create_auto_outbound_listenerto avoid much of code duplication).Other possible uses for
auto_outbound_modeI could think of are more detailed testing of anchors (feature_anchors.py), feeler connections, or any other p2p logic that uses the network of peers.