[avalanche] Fix an edge case that can assert when updating a node
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.
Reviewers: #bitcoin_abc, PiRK, deadalnix
Reviewed By: #bitcoin_abc, PiRK, deadalnix
Subscribers: PiRK, deadalnix
Maniphest Tasks: T1634
Differential Revision: https://reviews.bitcoinabc.org/D9754