Skip to content

Commit

Permalink
wrap dead error into box to save 16 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Nov 22, 2024
1 parent 609fb10 commit c34c570
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion yellowstone-grpc-proto/src/plugin/filter/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl FilteredUpdate {
slot: msg.slot,
parent: msg.parent,
status: msg.status as i32,
dead_error: msg.dead_error.clone(),
dead_error: msg.dead_error.as_ref().map(|error| error.as_ref().clone()),
}),
FilteredUpdateOneof::Transaction(msg) => {
UpdateOneof::Transaction(SubscribeUpdateTransaction {
Expand Down
6 changes: 3 additions & 3 deletions yellowstone-grpc-proto/src/plugin/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct MessageSlot {
pub slot: Slot,
pub parent: Option<Slot>,
pub status: CommitmentLevel,
pub dead_error: Option<String>,
pub dead_error: Option<Box<String>>,
}

impl MessageSlot {
Expand All @@ -110,7 +110,7 @@ impl MessageSlot {
parent,
status: status.into(),
dead_error: if let SlotStatus::Dead(error) = status {
Some(error.to_owned())
Some(Box::new(error.to_owned()))
} else {
None
},
Expand All @@ -124,7 +124,7 @@ impl MessageSlot {
status: CommitmentLevelProto::try_from(msg.status)
.map_err(|_| "failed to parse commitment level")?
.into(),
dead_error: msg.dead_error.clone(),
dead_error: msg.dead_error.clone().map(Box::new),
})
}
}
Expand Down

0 comments on commit c34c570

Please sign in to comment.