diff options
author | Prayank <prayank23@outlook.com> | 2020-09-17 00:46:07 -0700 |
---|---|---|
committer | Elliott Jin <elliott.jin@gmail.com> | 2020-10-20 00:42:00 -0700 |
commit | 4b16c614616c1ff09e5b1dcd58516bcb9a88e5e8 (patch) | |
tree | 834bfc54b5a403c441c428311103f32f9d4f9ef4 /test/functional/feature_pruning.py | |
parent | be386840d4a394a1b6221fb7d0fa2b0bc4b1d413 (diff) | |
download | bitcoin-4b16c614616c1ff09e5b1dcd58516bcb9a88e5e8.tar.xz |
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>
Diffstat (limited to 'test/functional/feature_pruning.py')
-rwxr-xr-x | test/functional/feature_pruning.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index e370e11a3e..f09bffe2d4 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -18,8 +18,6 @@ from test_framework.util import ( assert_equal, assert_greater_than, assert_raises_rpc_error, - connect_nodes, - disconnect_nodes, ) # Rescans start at the earliest block up to 2 hours before a key timestamp, so @@ -102,11 +100,11 @@ class PruneTest(BitcoinTestFramework): self.prunedir = os.path.join(self.nodes[2].datadir, self.chain, 'blocks', '') - connect_nodes(self.nodes[0], 1) - connect_nodes(self.nodes[1], 2) - connect_nodes(self.nodes[0], 2) - connect_nodes(self.nodes[0], 3) - connect_nodes(self.nodes[0], 4) + self.connect_nodes(0, 1) + self.connect_nodes(1, 2) + self.connect_nodes(0, 2) + self.connect_nodes(0, 3) + self.connect_nodes(0, 4) self.sync_blocks(self.nodes[0:5]) def setup_nodes(self): @@ -148,8 +146,8 @@ class PruneTest(BitcoinTestFramework): for _ in range(12): # Disconnect node 0 so it can mine a longer reorg chain without knowing about node 1's soon-to-be-stale chain # Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects - disconnect_nodes(self.nodes[0], 1) - disconnect_nodes(self.nodes[0], 2) + self.disconnect_nodes(0, 1) + self.disconnect_nodes(0, 2) # Mine 24 blocks in node 1 mine_large_blocks(self.nodes[1], 24) @@ -157,8 +155,8 @@ class PruneTest(BitcoinTestFramework): mine_large_blocks(self.nodes[0], 25) # Create connections in the order so both nodes can see the reorg at the same time - connect_nodes(self.nodes[0], 1) - connect_nodes(self.nodes[0], 2) + self.connect_nodes(0, 1) + self.connect_nodes(0, 2) self.sync_blocks(self.nodes[0:3]) self.log.info("Usage can be over target because of high stale rate: %d" % calc_usage(self.prunedir)) @@ -187,15 +185,15 @@ class PruneTest(BitcoinTestFramework): self.log.info("New best height: %d" % self.nodes[1].getblockcount()) # Disconnect node1 and generate the new chain - disconnect_nodes(self.nodes[0], 1) - disconnect_nodes(self.nodes[1], 2) + self.disconnect_nodes(0, 1) + self.disconnect_nodes(1, 2) self.log.info("Generating new longer chain of 300 more blocks") self.nodes[1].generate(300) self.log.info("Reconnect nodes") - connect_nodes(self.nodes[0], 1) - connect_nodes(self.nodes[1], 2) + self.connect_nodes(0, 1) + self.connect_nodes(1, 2) self.sync_blocks(self.nodes[0:3], timeout=120) self.log.info("Verify height on node 2: %d" % self.nodes[2].getblockcount()) @@ -336,7 +334,7 @@ class PruneTest(BitcoinTestFramework): # check that wallet loads successfully when restarting a pruned node after IBD. # this was reported to fail in #7494. self.log.info("Syncing node 5 to test wallet") - connect_nodes(self.nodes[0], 5) + self.connect_nodes(0, 5) nds = [self.nodes[0], self.nodes[5]] self.sync_blocks(nds, wait=5, timeout=300) self.restart_node(5, extra_args=["-prune=550"]) # restart to trigger rescan |