-
Notifications
You must be signed in to change notification settings - Fork 20
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
New RPC call, getaddressrank and getaddressleaderboard #363
Conversation
src/rpc/misc.cpp
Outdated
UniValue o(UniValue::VOBJ); | ||
|
||
//percentile to two digits | ||
double percentile = |
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.
Another approach might be to sprintf("%.2f", (static_cast<double>(r.second) / static_cast<double>(total)) * 100)
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.
Thanks for the code review suggestions!
src/rpc/misc.cpp
Outdated
} | ||
|
||
CAmount lottery_anv = pog::GetCachedTotalANV(); | ||
if(lottery_anv == 0) { |
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.
- space /pedantic
src/rpc/misc.cpp
Outdated
); | ||
|
||
CAmount lottery_anv = pog::GetCachedTotalANV(); | ||
if(lottery_anv == 0) { |
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.
- space /pedantic
src/rpc/misc.cpp
Outdated
return rankarr; | ||
} | ||
|
||
UniValue getaddressrank(const JSONRPCRequest& request) |
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 DRY + duplication between this and getaddressleaderboard
. I don't have a concrete suggestion for how to address it but something to consider.
src/validation.cpp
Outdated
referral::AddressANVs entrants; | ||
|
||
// unlikely that the candidates grew over 50% since last time. | ||
auto reserve_size = max_embassador_lottery * 1.5; |
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.
Nitpick: it's s/embassador/ambassador (unless this is on purpose and I'm not familiar with the jargon).
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
In an effort to promote more transparency into the ambassador reward lottery, this PR introduces an RPC call called "getaddressrank", which provides information about an addresses rank in the community and enough information to compute a probability of winning an ambassador reward.