fix: actually vote NO on triggers we don't like, some additional cleanups and tests#5670
Merged
UdjinM6 merged 6 commits intodashpay:developfrom Nov 6, 2023
Merged
fix: actually vote NO on triggers we don't like, some additional cleanups and tests#5670UdjinM6 merged 6 commits intodashpay:developfrom
UdjinM6 merged 6 commits intodashpay:developfrom
Conversation
src/governance/governance.h
Outdated
Comment on lines
+296
to
+297
| const std::optional<CSuperblock> CreateSuperblockCandidate(int nHeight) const; | ||
| const std::optional<CGovernanceObject> CreateGovernanceTrigger(const std::optional<CSuperblock>& sb_opt, CConnman& connman); |
Member
There was a problem hiding this comment.
what is your goal marking these returned values as const?
Member
There was a problem hiding this comment.
I think probably if anything you may want std::optional<const T> but probably not const std::optional<T>
knst
requested changes
Nov 6, 2023
Collaborator
There was a problem hiding this comment.
it looks fine, but check a comment about mnPayee.
I don't also like a new method in public section that accept std::optional because it should not be public but private; and because it doesn't do anything if its argument is nullopt - better to don't call this method at all IMO; but it's not a blocker to get merged.
src/governance/governance.cpp
Outdated
Comment on lines
+682
to
+683
| auto mnList = deterministicMNManager->GetListForBlock(::ChainActive().Tip()); | ||
| auto mn_payees = mnList.GetProjectedMNPayees(::ChainActive().Tip()); |
Collaborator
There was a problem hiding this comment.
Suggested change
| auto mnList = deterministicMNManager->GetListForBlock(::ChainActive().Tip()); | |
| auto mn_payees = mnList.GetProjectedMNPayees(::ChainActive().Tip()); | |
| const CBlockIndex *tip = WITH_LOCK(::cs_main, return ::ChainActive().Tip()); | |
| auto mnList = deterministicMNManager->GetListForBlock(tip); | |
| auto mn_payees = mnList.GetProjectedMNPayees(tip); |
tip MUST be same for GetListForBlock and for GetProjectedMNPayees due to #5590
PastaPastaPasta
approved these changes
Nov 6, 2023
Author
|
CI is ✅ |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue being fixed or feature implemented
MNs don't really vote NO on triggers that do not match their local candidates because:
What was done?
Moved voting out of
CreateGovernanceTriggerand into its ownVoteGovernanceTriggers. Refactored related code to useoptionalwhile at it, dropped useless/misleadingIsValid()call. Added some safety belts, logging, tests.How Has This Been Tested?
Run tests.
Breaking Changes
n/a
Checklist: