Skip to content

Commit

Permalink
Ledger tool cap basic columns (#13904)
Browse files Browse the repository at this point in the history
* ledger-tool cap: Add more basic columns

* simplify InflationRecord::rewarded_epoch type
  • Loading branch information
ryoqun authored Dec 2, 2020
1 parent 0f76daa commit 480dd15
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,8 @@ fn main() {
if let Some(ref mut csv_writer) = csv_writer {
#[derive(Serialize)]
struct InflationRecord {
cluster_type: String,
rewarded_epoch: Epoch,
account: String,
owner: String,
old_balance: u64,
Expand All @@ -2362,6 +2364,8 @@ fn main() {
commission: String,
cluster_rewards: String,
cluster_points: String,
old_capitalization: u64,
new_capitalization: u64,
};
fn format_or_na<T: std::fmt::Display>(
data: Option<T>,
Expand All @@ -2380,6 +2384,8 @@ fn main() {

for point_detail in point_details {
let record = InflationRecord {
cluster_type: format!("{:?}", base_bank.cluster_type()),
rewarded_epoch: base_bank.epoch(),
account: format!("{}", pubkey),
owner: format!("{}", base_account.owner),
old_balance: base_account.lamports,
Expand Down Expand Up @@ -2442,6 +2448,8 @@ fn main() {
cluster_points: format_or_na(
last_point_value.as_ref().map(|pv| pv.points),
),
old_capitalization: base_bank.capitalization(),
new_capitalization: warped_bank.capitalization(),
};
csv_writer.serialize(&record).unwrap();
}
Expand Down

0 comments on commit 480dd15

Please sign in to comment.