Provide a way to create the machine

The BasicQueue returned obscures the TendermintImport struct. 
Accordingly, a Future scoped with access is returned upwards, which when 
awaited will create the machine. This makes creating the machine 
optional while maintaining scope boundaries.

Is sufficient to create a 1-node net which produces and finalizes 
blocks.
This commit is contained in:
Luke Parker
2022-10-22 03:41:49 -04:00
parent 39984bd07b
commit 9b0dca06d0
8 changed files with 104 additions and 89 deletions

View File

@@ -1,7 +1,6 @@
use std::sync::Arc;
use std::{sync::Arc, future::Future};
use sp_api::TransactionFor;
use sp_consensus::Error;
use sc_executor::{NativeVersion, NativeExecutionDispatch, NativeElseWasmExecutor};
use sc_transaction_pool::FullPool;
@@ -50,8 +49,8 @@ pub fn import_queue(
client: Arc<FullClient>,
pool: Arc<FullPool<Block, FullClient>>,
registry: Option<&Registry>,
) -> Result<TendermintImportQueue<Block, TransactionFor<FullClient, Block>>, Error> {
Ok(import_queue::import_queue(
) -> (impl Future<Output = ()>, TendermintImportQueue<Block, TransactionFor<FullClient, Block>>) {
import_queue::import_queue(
client.clone(),
client.clone(),
Arc::new(|_, _| async { Ok(sp_timestamp::InherentDataProvider::from_system_time()) }),
@@ -64,18 +63,7 @@ pub fn import_queue(
),
&task_manager.spawn_essential_handle(),
registry,
))
}
// If we're an authority, produce blocks
pub fn authority(
task_manager: &TaskManager,
client: Arc<FullClient>,
network: Arc<sc_network::NetworkService<Block, <Block as sp_runtime::traits::Block>::Hash>>,
pool: Arc<FullPool<Block, FullClient>>,
registry: Option<&Registry>,
) {
todo!()
)
}
/*