Skip to content

Commit facd97a

Browse files
author
MarcoFalke
committed
scripted-diff: Renames
-BEGIN VERIFY SCRIPT- ren() { sed -i "s/\<$1\>/$2/g" test/functional/p2p_blockfilters.py ; } # Rename from "node" to "peer" to avoid confusion with self.nodes ren node0 peer_0 ren node1 peer_1 # Remove the confusing "C" prefix ren CFiltersClient FiltersClient -END VERIFY SCRIPT-
1 parent 327e269 commit facd97a

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

test/functional/p2p_blockfilters.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
assert_equal,
2525
)
2626

27-
class CFiltersClient(P2PInterface):
27+
class FiltersClient(P2PInterface):
2828
def __init__(self):
2929
super().__init__()
3030
# Store the cfilters received.
@@ -51,8 +51,8 @@ def set_test_params(self):
5151

5252
def run_test(self):
5353
# Node 0 supports COMPACT_FILTERS, node 1 does not.
54-
node0 = self.nodes[0].add_p2p_connection(CFiltersClient())
55-
node1 = self.nodes[1].add_p2p_connection(CFiltersClient())
54+
peer_0 = self.nodes[0].add_p2p_connection(FiltersClient())
55+
peer_1 = self.nodes[1].add_p2p_connection(FiltersClient())
5656

5757
# Nodes 0 & 1 share the same first 999 blocks in the chain.
5858
self.nodes[0].generate(999)
@@ -69,8 +69,8 @@ def run_test(self):
6969
self.wait_until(lambda: self.nodes[1].getblockcount() == 2000)
7070

7171
# Check that nodes have signalled NODE_COMPACT_FILTERS correctly.
72-
assert node0.nServices & NODE_COMPACT_FILTERS != 0
73-
assert node1.nServices & NODE_COMPACT_FILTERS == 0
72+
assert peer_0.nServices & NODE_COMPACT_FILTERS != 0
73+
assert peer_1.nServices & NODE_COMPACT_FILTERS == 0
7474

7575
# Check that the localservices is as expected.
7676
assert int(self.nodes[0].getnetworkinfo()['localservices'], 16) & NODE_COMPACT_FILTERS != 0
@@ -81,8 +81,8 @@ def run_test(self):
8181
filter_type=FILTER_TYPE_BASIC,
8282
stop_hash=int(stale_block_hash, 16)
8383
)
84-
node0.send_and_ping(message=request)
85-
response = node0.last_message['cfcheckpt']
84+
peer_0.send_and_ping(message=request)
85+
response = peer_0.last_message['cfcheckpt']
8686
assert_equal(response.filter_type, request.filter_type)
8787
assert_equal(response.stop_hash, request.stop_hash)
8888
assert_equal(len(response.headers), 1)
@@ -100,8 +100,8 @@ def run_test(self):
100100
filter_type=FILTER_TYPE_BASIC,
101101
stop_hash=int(tip_hash, 16)
102102
)
103-
node0.send_and_ping(request)
104-
response = node0.last_message['cfcheckpt']
103+
peer_0.send_and_ping(request)
104+
response = peer_0.last_message['cfcheckpt']
105105
assert_equal(response.filter_type, request.filter_type)
106106
assert_equal(response.stop_hash, request.stop_hash)
107107

@@ -117,8 +117,8 @@ def run_test(self):
117117
filter_type=FILTER_TYPE_BASIC,
118118
stop_hash=int(stale_block_hash, 16)
119119
)
120-
node0.send_and_ping(request)
121-
response = node0.last_message['cfcheckpt']
120+
peer_0.send_and_ping(request)
121+
response = peer_0.last_message['cfcheckpt']
122122

123123
stale_cfcheckpt = self.nodes[0].getblockfilter(stale_block_hash, 'basic')['header']
124124
assert_equal(
@@ -132,8 +132,8 @@ def run_test(self):
132132
start_height=1,
133133
stop_hash=int(main_block_hash, 16)
134134
)
135-
node0.send_and_ping(request)
136-
response = node0.last_message['cfheaders']
135+
peer_0.send_and_ping(request)
136+
response = peer_0.last_message['cfheaders']
137137
main_cfhashes = response.hashes
138138
assert_equal(len(main_cfhashes), 1000)
139139
assert_equal(
@@ -147,8 +147,8 @@ def run_test(self):
147147
start_height=1,
148148
stop_hash=int(stale_block_hash, 16)
149149
)
150-
node0.send_and_ping(request)
151-
response = node0.last_message['cfheaders']
150+
peer_0.send_and_ping(request)
151+
response = peer_0.last_message['cfheaders']
152152
stale_cfhashes = response.hashes
153153
assert_equal(len(stale_cfhashes), 1000)
154154
assert_equal(
@@ -163,9 +163,9 @@ def run_test(self):
163163
start_height=1,
164164
stop_hash=int(stop_hash, 16)
165165
)
166-
node0.send_message(request)
167-
node0.sync_with_ping()
168-
response = node0.pop_cfilters()
166+
peer_0.send_message(request)
167+
peer_0.sync_with_ping()
168+
response = peer_0.pop_cfilters()
169169
assert_equal(len(response), 10)
170170

171171
self.log.info("Check that cfilter responses are correct.")
@@ -182,9 +182,9 @@ def run_test(self):
182182
start_height=1000,
183183
stop_hash=int(stale_block_hash, 16)
184184
)
185-
node0.send_message(request)
186-
node0.sync_with_ping()
187-
response = node0.pop_cfilters()
185+
peer_0.send_message(request)
186+
peer_0.sync_with_ping()
187+
response = peer_0.pop_cfilters()
188188
assert_equal(len(response), 1)
189189

190190
cfilter = response[0]
@@ -211,9 +211,9 @@ def run_test(self):
211211
),
212212
]
213213
for request in requests:
214-
node1 = self.nodes[1].add_p2p_connection(P2PInterface())
215-
node1.send_message(request)
216-
node1.wait_for_disconnect()
214+
peer_1 = self.nodes[1].add_p2p_connection(P2PInterface())
215+
peer_1.send_message(request)
216+
peer_1.wait_for_disconnect()
217217

218218
self.log.info("Check that invalid requests result in disconnection.")
219219
requests = [
@@ -241,9 +241,9 @@ def run_test(self):
241241
),
242242
]
243243
for request in requests:
244-
node0 = self.nodes[0].add_p2p_connection(P2PInterface())
245-
node0.send_message(request)
246-
node0.wait_for_disconnect()
244+
peer_0 = self.nodes[0].add_p2p_connection(P2PInterface())
245+
peer_0.send_message(request)
246+
peer_0.wait_for_disconnect()
247247

248248
def compute_last_header(prev_header, hashes):
249249
"""Compute the last filter header from a starting header and a sequence of filter hashes."""

0 commit comments

Comments
 (0)