v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31
test/functional/p2p_disconnect_ban.py
Before: test/functional/p2p_disconnect_ban.py · After: test/functional/p2p_disconnect_ban.py
File metadata
index e7168b72546826eb76b05636cdb3754b135177ec..a829e316faf41d3827484fbef43803b4ba7e53bd 100755
Download original patch · Release notes
Diff rows 1–19 of 19. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/p2p_disconnect_ban.py
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
import time
|
| 7 |
from pathlib import Path
|
| 8 |
|
|
|
|
| 9 |
from test_framework.test_framework import BitcoinTestFramework
|
| 10 |
from test_framework.util import (
|
| 11 |
assert_equal,
|
|
@@ -145,5 +146,12 @@ class DisconnectBanTest(BitcoinTestFramework):
|
|
| 145 |
self.wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 1, timeout=10)
|
| 146 |
assert not [node for node in self.nodes[0].getpeerinfo() if node['id'] == id1]
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
if __name__ == '__main__':
|
| 149 |
DisconnectBanTest(__file__).main()
|
|
|
|
| 6 |
import time
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
+
from test_framework.p2p import P2PInterface
|
| 10 |
from test_framework.test_framework import BitcoinTestFramework
|
| 11 |
from test_framework.util import (
|
| 12 |
assert_equal,
|
|
|
|
| 146 |
self.wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 1, timeout=10)
|
| 147 |
assert not [node for node in self.nodes[0].getpeerinfo() if node['id'] == id1]
|
| 148 |
|
| 149 |
+
self.log.info("disconnectnode: validate and disconnect all peers in a subnet")
|
| 150 |
+
assert_raises_rpc_error(-8, "Invalid subnet", self.nodes[0].disconnectnode, address="127.0.0.1/999")
|
| 151 |
+
self.nodes[0].add_p2p_connection(P2PInterface())
|
| 152 |
+
self.nodes[0].disconnectnode(address="127.0.0.0/8")
|
| 153 |
+
self.wait_until(lambda: not self.nodes[0].getpeerinfo())
|
| 154 |
+
assert_raises_rpc_error(-29, "Node not found", self.nodes[0].disconnectnode, address="127.0.0.0/8")
|
| 155 |
+
|
| 156 |
if __name__ == '__main__':
|
| 157 |
DisconnectBanTest(__file__).main()
|