Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.9.0"
version = "0.9.1"
edition = "2021"
rust-version = "1.81"
authors = ["init4"]
Expand Down
2 changes: 1 addition & 1 deletion crates/test-utils/src/specs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod host_spec;
pub use host_spec::HostBlockSpec;

mod notif_spec;
pub use notif_spec::{NotificationSpec, NotificationWithSidecars};
pub use notif_spec::{ExExNotification, NotificationSpec, NotificationWithSidecars};

mod ru_spec;
pub use ru_spec::RuBlockSpec;
Expand Down
20 changes: 20 additions & 0 deletions crates/test-utils/src/specs/notif_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ pub enum ExExNotification {
},
}

impl ExExNotification {
/// Returns the committed chain, if any.
pub fn committed_chain(&self) -> Option<&Arc<Chain>> {
match self {
ExExNotification::Committed { new } => Some(new),
ExExNotification::Reorged { new, .. } => Some(new),
ExExNotification::Reverted { .. } => None,
}
}

/// Returns the reverted chain, if any.
pub fn reverted_chain(&self) -> Option<&Arc<Chain>> {
match self {
ExExNotification::Reorged { old, .. } => Some(old),
ExExNotification::Reverted { old } => Some(old),
ExExNotification::Committed { .. } => None,
}
}
}

/// A notification spec.
#[derive(Debug, Default)]
pub struct NotificationSpec {
Expand Down