This factorizes the code used to extract invs from the vote records.
It fixes a bug than can lead to polling AVALANCHE_MAX_ELEMENT_POLL + 1 elements and adds a test for this case.
Ref T1854.
Differential D10327
[avalanche] Refactor the vote records to inv extraction loop Fabien on Oct 13 2021, 14:55. Authored by
Details
This factorizes the code used to extract invs from the vote records. It fixes a bug than can lead to polling AVALANCHE_MAX_ELEMENT_POLL + 1 elements and adds a test for this case. Ref T1854. ninja all check-all
Diff Detail
Event Timeline
Comment Actions Make the loop interruption point a parameter. The reason why I did not use a range loop is that you have one case of forward loop and one case of backward loop, so iterators provide a generic interface that works for both cases. This will be reflected in the summary.
Comment Actions Use a range loop, rebase on top of D10365 to avoid the block vote slot reservation, use structured binding for the pair.
Comment Actions Your comment made me figure out that there is a bug in the current code. Returning the bool and using it actually fixes the bug. Comment Actions Belt and suspenders: check if the vector is full before appending elements so it no longer relies on the caller to check the returned value to prevent overflow. |