Page MenuHomePhabricator

[avalanche] Make sure to only promote contenders once for each proofid
ClosedPublic

Authored by roqqit on Wed, Mar 26, 23:12.

Details

Summary

Looping over the contenders container while inserting causes the loop to go over the newly inserted items which is not intended. For better or worse, double inserting a contender has no change in behavior, so this diff does not either.

Depends on D17860

Test Plan
./test/functional/test_runner.py --nocleanup abc_p2p_avalanche_contender_voting

Verify in the log that when contenders are promoted, "new id <contenderid>" never appears duplicated.

Diff Detail

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

Event Timeline

roqqit requested review of this revision.Wed, Mar 26, 23:12
Fabien requested changes to this revision.Thu, Mar 27, 09:36
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/stakecontendercache.cpp
75 ↗(On Diff #53274)

You don't need the set. The new contender id will be the same if you have a proofid promoted several times (because they are present for several past blocks) and the insert below will just skip them safely.

This revision now requires changes to proceed.Thu, Mar 27, 09:36

remove the set because it is not really needed

This revision is now accepted and ready to land.Thu, Mar 27, 17:41