mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(exex): ExExNotification::into_inverted (#11205)
This commit is contained in:
@ -43,6 +43,20 @@ impl ExExNotification {
|
||||
Self::ChainCommitted { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts the notification into a notification that is the inverse of the original one.
|
||||
///
|
||||
/// - For [`Self::ChainCommitted`], it's [`Self::ChainReverted`].
|
||||
/// - For [`Self::ChainReverted`], it's [`Self::ChainCommitted`].
|
||||
/// - For [`Self::ChainReorged`], it's [`Self::ChainReorged`] with the new chain as the old
|
||||
/// chain and the old chain as the new chain.
|
||||
pub fn into_inverted(self) -> Self {
|
||||
match self {
|
||||
Self::ChainCommitted { new } => Self::ChainReverted { old: new },
|
||||
Self::ChainReverted { old } => Self::ChainCommitted { new: old },
|
||||
Self::ChainReorged { old, new } => Self::ChainReorged { old: new, new: old },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CanonStateNotification> for ExExNotification {
|
||||
|
||||
Reference in New Issue
Block a user