diff --git a/cli-output/src/display.rs b/cli-output/src/display.rs index 2f2d2728277ba3..a2f12e03454eb8 100644 --- a/cli-output/src/display.rs +++ b/cli-output/src/display.rs @@ -263,7 +263,11 @@ fn write_transaction( write_status(w, &transaction_status.status, prefix)?; write_fees(w, transaction_status.fee, prefix)?; write_balances(w, transaction_status, prefix)?; - write_compute_units_consumed(w, transaction_status.compute_units_consumed, prefix)?; + write_compute_units_consumed( + w, + transaction_status.compute_units_consumed.clone().into(), + prefix, + )?; write_log_messages(w, transaction_status.log_messages.as_ref().into(), prefix)?; write_return_data(w, transaction_status.return_data.as_ref().into(), prefix)?; write_rewards(w, transaction_status.rewards.as_ref().into(), prefix)?; diff --git a/rpc-client/src/mock_sender.rs b/rpc-client/src/mock_sender.rs index a0b8c8706c1152..346c75278e461c 100644 --- a/rpc-client/src/mock_sender.rs +++ b/rpc-client/src/mock_sender.rs @@ -231,7 +231,7 @@ impl RpcSender for MockSender { rewards: OptionSerializer::None, loaded_addresses: OptionSerializer::Skip, return_data: OptionSerializer::Skip, - compute_units_consumed: None, + compute_units_consumed: OptionSerializer::Skip, }), }, block_time: Some(1628633791), diff --git a/transaction-status/src/lib.rs b/transaction-status/src/lib.rs index 399d4c7300f822..32a0b5e0f03233 100644 --- a/transaction-status/src/lib.rs +++ b/transaction-status/src/lib.rs @@ -363,8 +363,11 @@ pub struct UiTransactionStatusMeta { skip_serializing_if = "OptionSerializer::should_skip" )] pub return_data: OptionSerializer, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub compute_units_consumed: Option, + #[serde( + default = "OptionSerializer::skip", + skip_serializing_if = "OptionSerializer::should_skip" + )] + pub compute_units_consumed: OptionSerializer, } /// A duplicate representation of LoadedAddresses @@ -423,7 +426,7 @@ impl UiTransactionStatusMeta { return_data: OptionSerializer::or_skip( meta.return_data.map(|return_data| return_data.into()), ), - compute_units_consumed: meta.compute_units_consumed, + compute_units_consumed: OptionSerializer::or_skip(meta.compute_units_consumed), } } } @@ -454,7 +457,7 @@ impl From for UiTransactionStatusMeta { return_data: OptionSerializer::or_skip( meta.return_data.map(|return_data| return_data.into()), ), - compute_units_consumed: meta.compute_units_consumed, + compute_units_consumed: OptionSerializer::or_skip(meta.compute_units_consumed), } } }