From ef939ed2f6794f5080b8e9c1f376a0be18fd32c4 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Thu, 5 Apr 2018 09:57:44 +0200 Subject: [PATCH] Expose transaction pool from the polkadot service (#109) --- polkadot/service/src/lib.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/polkadot/service/src/lib.rs b/polkadot/service/src/lib.rs index d3daac84ca..ea33bad5ec 100644 --- a/polkadot/service/src/lib.rs +++ b/polkadot/service/src/lib.rs @@ -74,6 +74,7 @@ pub struct Service { thread: Option>, client: Arc, network: Arc, + transaction_pool: Arc>, _consensus: Option, } @@ -182,7 +183,7 @@ impl Service { // Load the first available key. Code above makes sure it exisis. let key = keystore.load(&keystore.contents()?[0], "")?; info!("Using authority key {:?}", key.public()); - Some(consensus::Service::new(client.clone(), network.clone(), transaction_pool, key, &best_header)) + Some(consensus::Service::new(client.clone(), network.clone(), transaction_pool.clone(), key, &best_header)) } else { None }; @@ -203,8 +204,9 @@ impl Service { }); Ok(Service { thread: Some(thread), - client: client.clone(), - network: network.clone(), + client: client, + network: network, + transaction_pool: transaction_pool, _consensus: consensus_service, }) } @@ -218,6 +220,11 @@ impl Service { pub fn network(&self) -> Arc { self.network.clone() } + + /// Get shared transaction pool instance. + pub fn transaction_pool(&self) -> Arc> { + self.transaction_pool.clone() + } } impl Drop for Service {