cli cleanup (#15990)

This commit is contained in:
Jack May 2021-03-18 11:29:42 -07:00 committed by GitHub
parent aa54c468ea
commit 067b390194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View File

@ -1685,6 +1685,7 @@ pub struct CliUpgradeableBuffer {
pub authority: String,
pub data_len: usize,
pub lamports: u64,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableBuffer {}
@ -1713,6 +1714,7 @@ impl fmt::Display for CliUpgradeableBuffer {
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeableBuffers {
pub buffers: Vec<CliUpgradeableBuffer>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableBuffers {}

View File

@ -1385,21 +1385,15 @@ fn process_close(
authority_signer,
)?;
if let Ok(UpgradeableLoaderState::Buffer { authority_address }) =
account.state()
{
buffers.push(CliUpgradeableBuffer {
address: account_pubkey.to_string(),
authority: authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
data_len: 0,
lamports: account.lamports,
use_lamports_unit,
});
} else {
return Err(format!("Error parsing account {}", account_pubkey).into());
}
buffers.push(CliUpgradeableBuffer {
address: account_pubkey.to_string(),
authority: authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
data_len: 0,
lamports: account.lamports,
use_lamports_unit,
});
}
} else {
return Err(format!(