-
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
Modernize Gov Methods #2326
Modernize Gov Methods #2326
Conversation
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.
Some Copy & Pasta 😜 went wrong. See inline comments.
src/governance-vote.cpp
Outdated
case VOTE_OUTCOME_ABSTAIN: | ||
return "ABSTAIN"; | ||
break; | ||
static const std::map<vote_signal_enum_t, std::string> mapOutcomeString = { |
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.
vote_outcome_enum_t
src/governance-vote.cpp
Outdated
case VOTE_SIGNAL_ENDORSED: | ||
strReturn = "ENDORSED"; | ||
break; | ||
static const std::map<std::string, vote_signal_enum_t> mapSignalsString = { |
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.
std::map<vote_signal_enum_t, std::string>
and name mapSignalString
instead of mapSignalsString
?
src/governance-vote.cpp
Outdated
const auto& it = mapSignalsString.find(nSignal); | ||
if (it == mapSignalsString.end()) { | ||
LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown signal %s\n", __func__, nSignal); | ||
return "NONE"; |
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.
Keep capitalized all returned strings? -or- Make this lowercase as well?
src/governance-vote.cpp
Outdated
eVote = VOTE_OUTCOME_NO; | ||
} else if (strVoteOutcome == "abstain") { | ||
eVote = VOTE_OUTCOME_ABSTAIN; | ||
static const std::map<vote_signal_enum_t, std::string> mapStringOutcome = { |
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.
std::map<std::string, vote_outcome_enum_t>
src/governance-vote.cpp
Outdated
|
||
const auto& it = mapOutcomeString.find(nOutcome); | ||
if (it == mapOutcomeString.end()) { | ||
LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown outcome %s\n", __func__, nOutcome); |
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'm not familiar with formatting, can it handle nOutcome
as %s
?
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.
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 wouldn't experiment with this and would simply use %d :)
🙈 🙈 🙈 |
…rtOutcomeToString" This reverts commit 41bc3d3.
fc39e8f
to
4daa269
Compare
Please re-review |
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 👍
utACK
src/governance-vote.cpp
Outdated
|
||
const auto& it = mapOutcomeString.find(nOutcome); | ||
if (it == mapOutcomeString.end()) { | ||
LogPrintf("CGovernanceVoting::%d -- ERROR: Unknown outcome %d\n", __func__, nOutcome); |
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.
%s
for __func__
? Same lower.
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.
Nice catch!
Please re-review |
hmmm... bd8d7ae is doing too much, I expected smth like
|
My bad 🙈 |
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 :)
* governance.* formatting and copyright bump * manual changes gov.cpp * Modernize ConvertVoteOutcome, ConvertSignalToString and ConvertOutcomeToString * move breaks * add braces instead of inlining * Revert "Modernize ConvertVoteOutcome, ConvertSignalToString and ConvertOutcomeToString" This reverts commit 41bc3d3. * Modernize ConvertVoteOutcome, ConvertSignalToString and ConvertOutcomeToString * fix bugs * make "NONE" lowercase * revert merge error * @InhumanPerfection comments fix * whoops
Only need to look at 7566796, currently based on #2324, will be rebased once #2324 has been merged