Page MenuHomePhabricator

[avalanche] Clarify the proof accessor API
ClosedPublic

Authored by Fabien on Oct 21 2021, 13:42.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABCf03a3e0c3b3c: [avalanche] Clarify the proof accessor API
Summary

The getProof() and exists() methods only target valid proof and not the orphans. This diff changes this API so it is easier to retrieve any known proof from its ID.

Ref T1854.

Test Plan
ninja check-extended

Diff Detail

Event Timeline

Fabien requested review of this revision.Oct 21 2021, 13:42
deadalnix requested changes to this revision.Oct 21 2021, 20:13
deadalnix added a subscriber: deadalnix.

Overall, lgtm. This is indeed much better.

I don't think the use a forPeer is very judicious, though. It obfuscate the code more than anything else.

src/avalanche/peermanager.cpp
228

That seems to be a very convoluted way to do

auto &pview = peers.get<proof_index>();
return pview.find(proofid) != pview.end();
This revision now requires changes to proceed.Oct 21 2021, 20:13

Don't use forPeer() when there is nothing to do on the peer

This revision is now accepted and ready to land.Oct 25 2021, 21:12
This revision was automatically updated to reflect the committed changes.