Page MenuHomePhabricator

[avalanche] Remove requirement that local staking rewards have to be computed in order to poll contenders
ClosedPublic

Authored by roqqit on Wed, Apr 9, 22:22.

Details

Summary

This is more robust in the event that staking rewards fails to compute for a minority of nodes. We had this happen on one node during testnet testing.

Test Plan
ninja check
./test/functional/test_runner.py abc_p2p_avalanche_contender_voting

Diff Detail

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

Event Timeline

roqqit requested review of this revision.Wed, Apr 9, 22:22
Fabien added inline comments.
src/avalanche/processor.cpp
910 ↗(On Diff #53435)

This returns false if winners size is 0, so this whole diff looks like there should be no change in behavior to me. What am I missing ?
I would expect this to work as expected by removing the winners.size() == 0 but also keeping the call to setContenderStatusForLocalWinners() outside of this if branch.

src/avalanche/processor.cpp
910 ↗(On Diff #53435)

Since the winners.size() == 0 requirement was removed during promotion (the other callsite to setContenderStatusForLocalWinners), we know some contenders will always be polled once they are promoted. So now when staking rewards are computed, we just need to make sure that the local winners that had status changes are also polled. There is no need to addToReconcile if no winners were selected since no status changes will have occurred.

This revision is now accepted and ready to land.Thu, Apr 10, 19:55