Skip to content
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

Merged
merged 12 commits into from
Oct 11, 2018
Merged

Modernize Gov Methods #2326

merged 12 commits into from
Oct 11, 2018

Conversation

PastaPastaPasta
Copy link
Member

Only need to look at 7566796, currently based on #2324, will be rebased once #2324 has been merged

@PastaPastaPasta PastaPastaPasta changed the title Modernize Gov Methods [WIP] Modernize Gov Methods Sep 27, 2018
Copy link

@InhumanPerfection InhumanPerfection left a 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.

case VOTE_OUTCOME_ABSTAIN:
return "ABSTAIN";
break;
static const std::map<vote_signal_enum_t, std::string> mapOutcomeString = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vote_outcome_enum_t

case VOTE_SIGNAL_ENDORSED:
strReturn = "ENDORSED";
break;
static const std::map<std::string, vote_signal_enum_t> mapSignalsString = {

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?

const auto& it = mapSignalsString.find(nSignal);
if (it == mapSignalsString.end()) {
LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown signal %s\n", __func__, nSignal);
return "NONE";

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?

eVote = VOTE_OUTCOME_NO;
} else if (strVoteOutcome == "abstain") {
eVote = VOTE_OUTCOME_ABSTAIN;
static const std::map<vote_signal_enum_t, std::string> mapStringOutcome = {

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>


const auto& it = mapOutcomeString.find(nOutcome);
if (it == mapOutcomeString.end()) {
LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown outcome %s\n", __func__, nOutcome);

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure ping: @UdjinM6 @nmarley

Copy link

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 :)

@PastaPastaPasta
Copy link
Member Author

🙈 🙈 🙈

@PastaPastaPasta
Copy link
Member Author

Please re-review

@PastaPastaPasta PastaPastaPasta changed the title [WIP] Modernize Gov Methods Modernize Gov Methods Oct 7, 2018
@UdjinM6 UdjinM6 added this to the 12.4 milestone Oct 8, 2018
UdjinM6
UdjinM6 previously approved these changes Oct 8, 2018
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

utACK


const auto& it = mapOutcomeString.find(nOutcome);
if (it == mapOutcomeString.end()) {
LogPrintf("CGovernanceVoting::%d -- ERROR: Unknown outcome %d\n", __func__, nOutcome);

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@UdjinM6 UdjinM6 dismissed their stale review October 8, 2018 22:07

there are few LogPrintfs to fix

@PastaPastaPasta
Copy link
Member Author

Please re-review

@UdjinM6
Copy link

UdjinM6 commented Oct 9, 2018

hmmm... bd8d7ae is doing too much, I expected smth like

LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown outcome %d\n", __func__, nOutcome);
...
LogPrintf("CGovernanceVoting::%s -- ERROR: Unknown signal %d\n", __func__, nSignal);

@PastaPastaPasta
Copy link
Member Author

My bad 🙈

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK :)

@UdjinM6 UdjinM6 merged commit 8deb8e9 into dashpay:develop Oct 11, 2018
@PastaPastaPasta PastaPastaPasta deleted the gov-modernize branch October 11, 2018 15:10
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request May 21, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants