Skip to content

Commit

Permalink
Consistent ImmutableDeserializedPacket::PartialEq (#3098)
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge authored Oct 8, 2024
1 parent f1b3856 commit 10b447f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/banking_stage/immutable_deserialized_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub enum DeserializedPacketError {
FailedFilter(#[from] PacketFilterFailure),
}

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Eq)]
pub struct ImmutableDeserializedPacket {
original_packet: Packet,
transaction: SanitizedVersionedTransaction,
Expand Down Expand Up @@ -132,6 +132,13 @@ impl ImmutableDeserializedPacket {
}
}

// PartialEq MUST be consistent with PartialOrd and Ord
impl PartialEq for ImmutableDeserializedPacket {
fn eq(&self, other: &Self) -> bool {
self.compute_unit_price() == other.compute_unit_price()
}
}

impl PartialOrd for ImmutableDeserializedPacket {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
Expand Down

0 comments on commit 10b447f

Please sign in to comment.