Add subscription to Pike namespace
@@ -38,6 +38,9 @@ use crate::sawtooth_connection::SawtoothConnection;
pub use super::event::error::{EventError, EventProcessorError};
+const PIKE_NAMESPACE: &'static str = "cad11d";
+const GRID_NAMESPACE: &'static str = "621dee";
+
const SHUTDOWN_TIMEOUT: u64 = 2;
pub trait EventHandler: Send {
@@ -219,13 +222,21 @@ fn create_subscription_request(last_known_block_id: String) -> ClientEventsSubsc
let mut grid_state_filter = EventFilter::new();
grid_state_filter.set_filter_type(EventFilter_FilterType::REGEX_ANY);
grid_state_filter.set_key("address".into());
- grid_state_filter.set_match_string("621dee.*".into());
+ grid_state_filter.set_match_string(format!("{}.*", GRID_NAMESPACE));
+
+ let mut pike_state_filter = EventFilter::new();
+ pike_state_filter.set_filter_type(EventFilter_FilterType::REGEX_ANY);
+ pike_state_filter.set_key("address".into());
+ pike_state_filter.set_match_string(format!("{}.*", PIKE_NAMESPACE));
let mut state_delta_subscription = EventSubscription::new();
state_delta_subscription.set_event_type("sawtooth/state-delta".into());
state_delta_subscription
.mut_filters()
.push(grid_state_filter);
+ state_delta_subscription
+ .mut_filters()
+ .push(pike_state_filter);
let mut request = ClientEventsSubscribeRequest::new();
request.mut_subscriptions().push(block_info_subscription);
