Record vote account commission with voting/staking rewards and surface in RPC

This commit is contained in:
Michael Vines
2021-07-10 23:18:42 -07:00
parent e322bc90cc
commit 4098af3b5b
17 changed files with 90 additions and 26 deletions

View File

@ -79,14 +79,14 @@ fn output_slot_rewards(blockstore: &Blockstore, slot: Slot, method: &LedgerOutpu
if !rewards.is_empty() {
println!(" Rewards:");
println!(
" {:<44} {:^15} {:<15} {:<20}",
"Address", "Type", "Amount", "New Balance"
" {:<44} {:^15} {:<15} {:<20} {:>10}",
"Address", "Type", "Amount", "New Balance", "Commission",
);
for reward in rewards {
let sign = if reward.lamports < 0 { "-" } else { "" };
println!(
" {:<44} {:^15} {:<15} {}",
" {:<44} {:^15} {:<15} {} {}",
reward.pubkey,
if let Some(reward_type) = reward.reward_type {
format!("{}", reward_type)
@ -98,7 +98,11 @@ fn output_slot_rewards(blockstore: &Blockstore, slot: Slot, method: &LedgerOutpu
sign,
lamports_to_sol(reward.lamports.abs() as u64)
),
format!("{:<18.9}", lamports_to_sol(reward.post_balance))
format!("{:<18.9}", lamports_to_sol(reward.post_balance)),
reward
.commission
.map(|commission| format!("{:>9}%", commission))
.unwrap_or_else(|| " -".to_string())
);
}
}