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:
parent
6a473373d4
commit
afc0224cdb
1 changed files with 2 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue