HomePhabricator

[avalanche] Fix an edge case that can assert when updating a node

Description

[avalanche] Fix an edge case that can assert when updating a node

Summary:
There is currently no real-world way to trigger this issue, but this will become possible once the node/peer binding is completed.

When a peer is removed, the nodes are removed as well unless they have an inflight query. This is done so if the node is bound to another peer at a later time is is not overqueried. But the the code updating the node will only work when the node moves from an existing peer to another existing one, and assert if the previous peer no longer exists.
This diff prevents this assertion and add a test that would raise the assertion before this patch.

Ref T1634.

Test Plan:

ninja check-avalanche

Reviewers: #bitcoin_abc, PiRK, deadalnix

Reviewed By: #bitcoin_abc, PiRK, deadalnix

Subscribers: PiRK, deadalnix

Maniphest Tasks: T1634

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

Details

Provenance
FabienAuthored on Jul 8 2021, 11:32
FabienPushed on Jul 8 2021, 13:04
Reviewer
Restricted Project
Differential Revision
D9754: [avalanche] Fix an edge case that can assert when updating a node
Parents
rABC49317e5958f8: [avalanche] Minor simplification in the fetchOrCreatePeer method
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task