-
Notifications
You must be signed in to change notification settings - Fork 324
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
[blockindex] restrict height for contract_staking_indexer during read operation #3927
Changes from 2 commits
6f3b8fd
a5fcd3a
0f88d0e
07e537b
f10a948
4ab8f36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -476,7 +476,11 @@ func (p *Protocol) ActiveCandidates(ctx context.Context, sr protocol.StateReader | |
featureCtx := protocol.MustGetFeatureCtx(ctx) | ||
for i := range list { | ||
if p.contractStakingIndexer != nil && featureCtx.AddContractStakingVotes { | ||
list[i].Votes.Add(list[i].Votes, p.contractStakingIndexer.CandidateVotes(list[i].Owner)) | ||
contractVotes, err := p.contractStakingIndexer.CandidateVotes(list[i].Owner, height) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be covered by unit test |
||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get CandidateVotes from contractStakingIndexer") | ||
} | ||
list[i].Votes.Add(list[i].Votes, contractVotes) | ||
} | ||
if list[i].SelfStake.Cmp(p.config.RegistrationConsts.MinSelfStake) >= 0 { | ||
cand = append(cand, list[i]) | ||
|
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.
not needed?
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.
yes, forget to revert