HomePhabricator

[avalanche] Fix a use after out-of-scope in peermanager tests

Description

[avalanche] Fix a use after out-of-scope in peermanager tests

Summary: The issue has been introduced in D14484. The blockhash for the blockindex is built and set from a loop local variable but not reset to some larger scope pointer after the loop exists, causing the fault on the subsequent use of the block hash. It doesn't impact the behavior of the test though, because at this point it checks there is no winner, so any blockhash value will work the same including garbage from freed memory.

Test Plan:
With ASAN:

ninja check-avalanche-peermanager_tests

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D14495

Details

Provenance
FabienAuthored on Sep 18 2023, 07:51
FabienPushed on Sep 18 2023, 11:18
Reviewer
Restricted Project
Differential Revision
D14495: [avalanche] Fix a use after out-of-scope in peermanager tests
Parents
rABCe93ab2a453e2: [avalanche] Use the new staking reward algorithm
Branches
Unknown
Tags
Unknown