Skip to content

Commit

Permalink
Add warn log if capitalization changes during create-snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed Feb 9, 2024
1 parent 245d1c4 commit a544113
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2024,8 +2024,20 @@ fn main() {
}
}

let pre_capitalization = bank.capitalization();

bank.set_capitalization();

let post_capitalization = bank.capitalization();
if pre_capitalization != post_capitalization {
let amount = if pre_capitalization > post_capitalization {
format!("-{}", pre_capitalization - post_capitalization)
} else {
(post_capitalization - pre_capitalization).to_string()
};
warn!("Capitalization change: {amount} lamports");
}

let bank = if let Some(warp_slot) = warp_slot {
// need to flush the write cache in order to use Storages to calculate
// the accounts hash, and need to root `bank` before flushing the cache
Expand Down

0 comments on commit a544113

Please sign in to comment.