Skip to content

Commit

Permalink
Improved error handling, so that it doesn't crash when a maintainer a…
Browse files Browse the repository at this point in the history
…ccounts has an empty balance
  • Loading branch information
ivanmetrikin authored Jul 17, 2024
1 parent bd082ad commit 90bcf02
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cli/maintainer/src/maintenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,15 @@ impl SolidoState {

let mut maintainer_balances = Vec::new();
for maintainer in maintainers.entries.iter() {
maintainer_balances.push(Lamports(
config.client.get_account(maintainer.pubkey())?.lamports,
));
let empty_account = Account::default();
let account = match config.client.get_account(maintainer.pubkey()) {
Ok(account) => account,
Err(err) => {
eprintln!("Failed to get account for maintainer: {:?}", maintainer.pubkey());
&empty_account
}
};
maintainer_balances.push(Lamports(account.lamports));
}

// The entity executing the maintenance transactions, is the maintainer.
Expand Down

0 comments on commit 90bcf02

Please sign in to comment.