-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugFix/rewards-missmatch-computation #1909
Conversation
epochStart/metachain/rewards.go
Outdated
ValidatorFailure uint32 | ||
NumSelectedInSuccessBlocks uint32 | ||
AccumulatedFees *big.Int | ||
numSelectedInSuccessBlocks uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tought I deleted all.
@@ -121,6 +118,7 @@ func NewEpochStartRewardsCreator(args ArgsNewRewardsCreator) (*rewardsCreator, e | |||
|
|||
// CreateBlockStarted announces block creation started and cleans inside data | |||
func (rc *rewardsCreator) clean() { | |||
rc.mapRewardsPerBlockPerValidator = make(map[uint32]*big.Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you do the same in the constructor so it won't be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need clean is called every time CreateRewards is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System tests passed.
Fixed the wrong computation of end of epoch rewards. In case the same validator had multiple nodes in multiple shards the actual reward was calculated with NumTotalSelected divided by the last shardID set for this validator. The last shard ID set was from range over a map.