Skip to content

Commit afc0224

Browse files
committed
test: refactor: remove unnecessary blocks_checked counter
Since we already store all the blocks in `events`, keeping an additional counter is redundant.
1 parent 6a47337 commit afc0224

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

test/functional/interface_usdt_validation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def __repr__(self):
8686
self.duration)
8787

8888
BLOCKS_EXPECTED = 2
89-
blocks_checked = 0
9089
expected_blocks = dict()
9190
events = []
9291

@@ -98,11 +97,10 @@ def __repr__(self):
9897
usdt_contexts=[ctx], debug=0)
9998

10099
def handle_blockconnected(_, data, __):
101-
nonlocal events, blocks_checked
100+
nonlocal events
102101
event = ctypes.cast(data, ctypes.POINTER(Block)).contents
103102
self.log.info(f"handle_blockconnected(): {event}")
104103
events.append(event)
105-
blocks_checked += 1
106104

107105
bpf["block_connected"].open_perf_buffer(
108106
handle_blockconnected)
@@ -127,7 +125,7 @@ def handle_blockconnected(_, data, __):
127125
# only plausibility checks
128126
assert event.duration > 0
129127
del expected_blocks[block_hash]
130-
assert_equal(BLOCKS_EXPECTED, blocks_checked)
128+
assert_equal(BLOCKS_EXPECTED, len(events))
131129
assert_equal(0, len(expected_blocks))
132130

133131
bpf.cleanup()

0 commit comments

Comments
 (0)