cli cleanup (#15990) (#15996)

(cherry picked from commit 067b390194)

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2021-03-18 21:02:59 +00:00
committed by GitHub
parent a5f8635fdc
commit e58365a160
2 changed files with 11 additions and 15 deletions

View File

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

View File

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