Page MenuHomePhabricator

[avalanche] Add a way to count the number of proofs in a ProofPool
ClosedPublic

Authored by sdulfari on Jun 3 2022, 04:04.

Details

Summary

This is the first piece needed in order to cap the size of proof pools by the
number of proofs. A simple cache of the proof count is provided to short
circuit the O(n) loop if nothing in the pool has changed.

Test Plan
ninja check-avalanche

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sdulfari requested review of this revision.Jun 3 2022, 04:04
src/avalanche/proofpool.cpp
72 ↗(On Diff #33798)

Technically this is redundant with the flag set in addProofIfNoConflict() but it's good form in case the implementation in this function changes in the future.

Fabien requested changes to this revision.Jun 4 2022, 01:29
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/proofpool.cpp
87 ↗(On Diff #33798)

You need to clear the cache here.
This also indicates a missing test case

This revision now requires changes to proceed.Jun 4 2022, 01:29

Fix cache clearing during rescan and test it

This revision is now accepted and ready to land.Jun 6 2022, 18:45