mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #19252: test: wait for disconnect in disconnect_p2ps + bloomfilter test followups
9a40cfc558b3f7fa4fff1270f969582af17479a5 [refactor] use waiting inside disconnect_p2ps (gzhao408) aeb9fb414e2d000830287d9dd3fed7fc2eb570d2 [test] wait for disconnect_p2ps to be reflected in getpeerinfo (gzhao408) e81942d2e1288367e8da94adb2b2a88be99e4751 [test] logging and style followups for bloomfilter tests (gzhao408) Pull request description: Followup to #19083 which adds bloomfilter-related tests. 1. Make test_node `disconnect_p2ps` wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's [comment](https://github.com/bitcoin/bitcoin/pull/19083#discussion_r437383989). And clean up any redundant `wait_until`s in the functional tests. 2. Clean up style + logging in p2p_filter.py and p2p_nobloomfilter_messages.py and jonatack's other [comments](https://github.com/bitcoin/bitcoin/pull/19083#pullrequestreview-428955784) ACKs for top commit: jonatack: Code review ACK 9a40cfc from re-reviewing the diff and `git range-diff 5cafb46 8386ad5 9a40cfc` MarcoFalke: ACK 9a40cfc558b3f7fa4fff1270f969582af17479a5 🐂 Tree-SHA512: 2e14b1c12fc08a355bd5ccad7a2a734a4ccda4bc7dc7bac171cb57359819fc1599d764290729af74832fac3e2be258c5d406c701e78ab6d7262835859b9a7d87
This commit is contained in:
parent
6c8020c70d
commit
8f0c22f93b
@ -131,9 +131,6 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
|
||||
# Wait until all connections are closed
|
||||
wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0)
|
||||
|
||||
# Make sure no unexpected messages came in
|
||||
assert no_version_bannode.unexpected_msg == False
|
||||
assert no_version_idlenode.unexpected_msg == False
|
||||
|
@ -77,7 +77,6 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
||||
assert_equal(node1.firstAddrnServices, expected_services)
|
||||
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
node1.wait_for_disconnect()
|
||||
|
||||
# connect unsynced node 2 with pruned NODE_NETWORK_LIMITED peer
|
||||
# because node 2 is in IBD and node 0 is a NODE_NETWORK_LIMITED peer, sync must not be possible
|
||||
|
@ -22,6 +22,7 @@ import sys
|
||||
import collections
|
||||
|
||||
from .authproxy import JSONRPCException
|
||||
from .messages import MY_SUBVERSION
|
||||
from .util import (
|
||||
MAX_NODES,
|
||||
append_config,
|
||||
@ -539,6 +540,10 @@ class TestNode():
|
||||
assert self.p2ps, self._node_msg("No p2p connection")
|
||||
return self.p2ps[0]
|
||||
|
||||
def num_connected_mininodes(self):
|
||||
"""Return number of test framework p2p connections to the node."""
|
||||
return len([peer for peer in self.getpeerinfo() if peer['subver'] == MY_SUBVERSION])
|
||||
|
||||
def disconnect_p2ps(self):
|
||||
"""Close all p2p connections to the node."""
|
||||
for p in self.p2ps:
|
||||
@ -554,6 +559,7 @@ class TestNode():
|
||||
wait_until(check_peers, timeout=5)
|
||||
|
||||
del self.p2ps[:]
|
||||
wait_until(lambda: self.num_connected_mininodes() == 0)
|
||||
|
||||
|
||||
class TestNodeCLIAttr:
|
||||
|
Loading…
Reference in New Issue
Block a user