Page MenuHomePhabricator

[avalanche] Remove unnecessary peer lookup after modifying the peer set
ClosedPublic

Authored by Fabien on Jun 24 2021, 12:12.

Details

Summary

The PeerManager::removeNodeFromPeer() methods calls modify() on the
peer set, and an additional lookup is performed to make sure the
iterator did not get invalidated during the operation. However according
to the documentation:

Validity of position is preserved if the operation succeeds

where position is the iterator:
https://www.boost.org/doc/libs/1_51_0/libs/multi_index/doc/reference/hash_indices.html#modify

Since the return value of the modify call is checked, the iterator is
guaranteed to remain valid. Furthermore, no key is modified which gives
an additional guarantee.

Test Plan
ninja all check-all

Diff Detail