HomePhabricator

[avalanche] Make removeProof easier to reason about by taking a proofid

Description

[avalanche] Make removeProof easier to reason about by taking a proofid

Summary:
The ProofPool container stores a proof reference but index them by their proof id. Having removeProof() take the proof ref makes it unclear that we are removing a proof with the same id and not a proof reference with the same underlying pointer, so this diff updates the API to take a proof id instead.

The proof id is still passed by value, as the common use case is to get a reference from proof->getId(). Since there might be several entries for that proof id (1 per utxo), the proof might be deleted and the id reference dangling as the erasure loop is processed.

Ref T1854.

Test Plan:

ninja all check

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Maniphest Tasks: T1854

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

Details

Provenance
FabienAuthored on Dec 15 2021, 10:06
FabienPushed on Dec 15 2021, 17:32
Reviewer
Restricted Project
Differential Revision
D10683: [avalanche] Make removeProof easier to reason about by taking a proofid
Parents
rABCfa6a6071853b: Refactor ProofPool::addProofIfPreferred
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task