Skip to content
Snippets Groups Projects
Commit 6b83f11a authored by Arkadiy Paronyan's avatar Arkadiy Paronyan Committed by Gav Wood
Browse files

Expose transaction pool from the polkadot service (#109)

parent b0d8eeb5
No related merge requests found
...@@ -74,6 +74,7 @@ pub struct Service { ...@@ -74,6 +74,7 @@ pub struct Service {
thread: Option<thread::JoinHandle<()>>, thread: Option<thread::JoinHandle<()>>,
client: Arc<Client>, client: Arc<Client>,
network: Arc<network::Service>, network: Arc<network::Service>,
transaction_pool: Arc<Mutex<TransactionPool>>,
_consensus: Option<consensus::Service>, _consensus: Option<consensus::Service>,
} }
...@@ -182,7 +183,7 @@ impl Service { ...@@ -182,7 +183,7 @@ impl Service {
// Load the first available key. Code above makes sure it exisis. // Load the first available key. Code above makes sure it exisis.
let key = keystore.load(&keystore.contents()?[0], "")?; let key = keystore.load(&keystore.contents()?[0], "")?;
info!("Using authority key {:?}", key.public()); 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 { } else {
None None
}; };
...@@ -203,8 +204,9 @@ impl Service { ...@@ -203,8 +204,9 @@ impl Service {
}); });
Ok(Service { Ok(Service {
thread: Some(thread), thread: Some(thread),
client: client.clone(), client: client,
network: network.clone(), network: network,
transaction_pool: transaction_pool,
_consensus: consensus_service, _consensus: consensus_service,
}) })
} }
...@@ -218,6 +220,11 @@ impl Service { ...@@ -218,6 +220,11 @@ impl Service {
pub fn network(&self) -> Arc<network::Service> { pub fn network(&self) -> Arc<network::Service> {
self.network.clone() self.network.clone()
} }
/// Get shared transaction pool instance.
pub fn transaction_pool(&self) -> Arc<Mutex<TransactionPool>> {
self.transaction_pool.clone()
}
} }
impl Drop for Service { impl Drop for Service {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment