Skip to content

Commit a64760e

Browse files
authored
fix: export exexnotification (#107)
1 parent 83c2791 commit a64760e

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.9.0"
6+
version = "0.9.1"
77
edition = "2021"
88
rust-version = "1.81"
99
authors = ["init4"]

crates/test-utils/src/specs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod host_spec;
22
pub use host_spec::HostBlockSpec;
33

44
mod notif_spec;
5-
pub use notif_spec::{NotificationSpec, NotificationWithSidecars};
5+
pub use notif_spec::{ExExNotification, NotificationSpec, NotificationWithSidecars};
66

77
mod ru_spec;
88
pub use ru_spec::RuBlockSpec;

crates/test-utils/src/specs/notif_spec.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ pub enum ExExNotification {
2525
},
2626
}
2727

28+
impl ExExNotification {
29+
/// Returns the committed chain, if any.
30+
pub fn committed_chain(&self) -> Option<&Arc<Chain>> {
31+
match self {
32+
ExExNotification::Committed { new } => Some(new),
33+
ExExNotification::Reorged { new, .. } => Some(new),
34+
ExExNotification::Reverted { .. } => None,
35+
}
36+
}
37+
38+
/// Returns the reverted chain, if any.
39+
pub fn reverted_chain(&self) -> Option<&Arc<Chain>> {
40+
match self {
41+
ExExNotification::Reorged { old, .. } => Some(old),
42+
ExExNotification::Reverted { old } => Some(old),
43+
ExExNotification::Committed { .. } => None,
44+
}
45+
}
46+
}
47+
2848
/// A notification spec.
2949
#[derive(Debug, Default)]
3050
pub struct NotificationSpec {

0 commit comments

Comments
 (0)