0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

test: refactor: remove unnecessary blocks_checked counter

Since we already store all the blocks in `events`, keeping an
additional counter is redundant.
This commit is contained in:
stickies-v 2023-06-23 11:02:59 +01:00
parent 6a473373d4
commit afc0224cdb
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757

View file

@ -86,7 +86,6 @@ class ValidationTracepointTest(BitcoinTestFramework):
self.duration)
BLOCKS_EXPECTED = 2
blocks_checked = 0
expected_blocks = dict()
events = []
@ -98,11 +97,10 @@ class ValidationTracepointTest(BitcoinTestFramework):
usdt_contexts=[ctx], debug=0)
def handle_blockconnected(_, data, __):
nonlocal events, blocks_checked
nonlocal events
event = ctypes.cast(data, ctypes.POINTER(Block)).contents
self.log.info(f"handle_blockconnected(): {event}")
events.append(event)
blocks_checked += 1
bpf["block_connected"].open_perf_buffer(
handle_blockconnected)
@ -127,7 +125,7 @@ class ValidationTracepointTest(BitcoinTestFramework):
# only plausibility checks
assert event.duration > 0
del expected_blocks[block_hash]
assert_equal(BLOCKS_EXPECTED, blocks_checked)
assert_equal(BLOCKS_EXPECTED, len(events))
assert_equal(0, len(expected_blocks))
bpf.cleanup()