-
Notifications
You must be signed in to change notification settings - Fork 168
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
refactor cli-output large functions and add starting epoch for rewards #3085
Conversation
86242f3
to
d15a944
Compare
d15a944
to
6faf55a
Compare
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.
left some comments
build_balance_message(active_stake, me.use_lamports_unit, true), | ||
)?; | ||
let activating_stake = me.activating_stake.or_else(|| { | ||
if me.active_stake.is_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.
I think might be simplified:
me.active_stake.is_none().then_some(delegated_stake)
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 another PR is best, I just wanted to move the logic as-is to make sure functionality is identical.
rpc_client | ||
.get_epoch_info()? | ||
.epoch | ||
.saturating_sub(num_epochs as u64) |
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 don't quite understand why do we subtract num_epochs
now (before we didn't). Before we subtract 1
in the loop before calling get_inflation_reward
so maybe should be also here subtract 1
?
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.
Because the loop was proceeding backwards by epoch before always from the newest epoch. I reversed the direction to now start at the older epoch and then move forward.
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.
num_epochs
has to be at least 1. So it will subtract 1 here in the default case.
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.
Agree, everything looks fine
Problem
Large functions in cli-output make the code hard to read.
No way to offset into the stake and vote rewards in case the user wants past rewards
Summary of Changes
Refactor functions into smaller ones.
Add
--starting-epoch <EPOCH_NUM>
argument tosolana vote-account --with-rewards
orstake-account
commands.Fixes #