fix: don't claim already claimed rewards#36
Conversation
|
|
||
| for ( let i = 1; i <= numOfPotentialUnclaimedPayouts; i++) { | ||
| const idx = lastReward + i; | ||
| if (claimedRewards.includes(idx)) { |
There was a problem hiding this comment.
hey @mkaczanowski, thanks for the PR.
Could you elaborate a bit on why this would be necessary ? shouldn't the "validatorInfo.lastReward" be enough, why do you think it is not trustable ?
There was a problem hiding this comment.
hey, iirc (I made this PR a while ago) the validatorInfo.lastReward is not sufficient if you run with the deepCheck. It's fairly simple to repro this issue:
- set deepcheck to true
- start payouts and see that TXes will be created for the eras that have already been paid.
from what I see by quickly skimming through the code the deep check will make the payouts start prior to the validatorInfo.lastReward, thus create TXes that can only be rejected/fail.
This case never really worked even in the original repo:
github.com/w3f/polkadot-payouts
and I remember applying the same fix (among others I haven't published). But I would instead merge everything I have upstream :)
|
@ironoa is this done in #50 (for polkadot-js/api#5859)? |
This PR fixes the issue where script "ignores" the
ledger.claimedRewardsand executes transactions for eras that have been already claimed.