mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-10 11:33:46 +02:00
scripted-diff: test: Replace uses of (dis)?connect_nodes global
-BEGIN VERIFY SCRIPT- # max-depth=0 excludes test/functional/test_framework/... FILES=$(git grep -l --max-depth 0 "connect_nodes" test/functional) # Replace (dis)?connect_nodes(self.nodes[a], b) with self.(dis)?connect_nodes(a, b) sed -i 's/\b\(dis\)\?connect_nodes(self\.nodes\[\(.*\)\]/self.\1connect_nodes(\2/g' $FILES # Remove imports in the middle of a line sed -i 's/\(dis\)\?connect_nodes, //g' $FILES sed -i 's/, \(dis\)\?connect_nodes//g' $FILES # Remove imports on a line by themselves sed -i '/^\s*\(dis\)\?connect_nodes,\?$/d' $FILES sed -i '/^from test_framework\.util import connect_nodes$/d' $FILES -END VERIFY SCRIPT- Co-authored-by: Elliott Jin <elliott.jin@gmail.com>
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
connect_nodes,
|
||||
p2p_port
|
||||
)
|
||||
|
||||
@@ -18,7 +17,7 @@ class SetBanTests(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
# Node 0 connects to Node 1, check that the noban permission is not granted
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.connect_nodes(0, 1)
|
||||
peerinfo = self.nodes[1].getpeerinfo()[0]
|
||||
assert(not 'noban' in peerinfo['permissions'])
|
||||
|
||||
@@ -32,14 +31,14 @@ class SetBanTests(BitcoinTestFramework):
|
||||
|
||||
# However, node 0 should be able to reconnect if it has noban permission
|
||||
self.restart_node(1, ['-whitelist=127.0.0.1'])
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.connect_nodes(0, 1)
|
||||
peerinfo = self.nodes[1].getpeerinfo()[0]
|
||||
assert('noban' in peerinfo['permissions'])
|
||||
|
||||
# If we remove the ban, Node 0 should be able to reconnect even without noban permission
|
||||
self.nodes[1].setban("127.0.0.1", "remove")
|
||||
self.restart_node(1, [])
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.connect_nodes(0, 1)
|
||||
peerinfo = self.nodes[1].getpeerinfo()[0]
|
||||
assert(not 'noban' in peerinfo['permissions'])
|
||||
|
||||
|
Reference in New Issue
Block a user