forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: Various fixes for GetProjectedMNPayees #5638
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
240e8a9
fix: GetProjectedMNPayees should take care of the block index it's us…
UdjinM6 f49dc1e
fix: handle GetProjectedMNPayees's failures in `MasternodeList::updat…
UdjinM6 3329fcf
fix: resulting vector in GetProjectedMNPayees grows to the weighted c…
UdjinM6 b9bc8f2
fix: avoid useless loop in GetProjectedMNPayees after mn_rr activation
UdjinM6 4699be4
typo
UdjinM6 1300cd1
fix: use `blockHash`
UdjinM6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't like using here global variable ::ChainActive().Tip().
Also there can be 2 different chain (2 forks on same time) and extracting pindex by [nHeight] can be incorrect value. if after mnList is generated the chain would be switched to other one; the value of
::ChainActive()[nHeight]
would be not expected and list would be wrong.For example call below:
pindexTip
is known but we lost this information.btw,
GetProjecctedMNPayees
is just estimation list; is not used in consensus rules; so, I don't think that we need to consider case of LOCKED_IN to make calculation 100% exact for case that happens only once in chain - during MN_RR activation, I vote for simplicity here.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.
also, if we will change exact known
pindex
by using::ChainActive()[nHeight]
it may cause similar bug not only in GUI code but in all usages ofGetProjecctedMNPayees
(that are non-GUI only), so in this case it can cause this issue getting bigger rather than beeing solved and we won't see it anymore because no crash -> seems works (but it does not). So, now I think that callg_chainman.m_blockman.LookupBlockIndex(blockHash))
is a proper solution until the BIP9 fork is buried (and we can use hardened height and drop g_chainman usage from here)