-
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: actually vote NO on triggers we don't like, some additional cleanups and tests #5670
Conversation
src/governance/governance.h
Outdated
const std::optional<CSuperblock> CreateSuperblockCandidate(int nHeight) const; | ||
const std::optional<CGovernanceObject> CreateGovernanceTrigger(const std::optional<CSuperblock>& sb_opt, CConnman& connman); |
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.
what is your goal marking these returned values as const?
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 think probably if anything you may want std::optional<const T>
but probably not const std::optional<T>
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.
oops 🙈 fixed
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.
utACK 👍
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.
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
auto mnList = deterministicMNManager->GetListForBlock(::ChainActive().Tip()); | ||
auto mn_payees = mnList.GetProjectedMNPayees(::ChainActive().Tip()); |
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.
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
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.
LGTM
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.
re-ACK
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.
utACK for squash merge; contingent on CI
CI is ✅ |
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
CreateGovernanceTrigger
and into its ownVoteGovernanceTriggers
. Refactored related code to useoptional
while at it, dropped useless/misleadingIsValid()
call. Added some safety belts, logging, tests.How Has This Been Tested?
Run tests.
Breaking Changes
n/a
Checklist: