referrerpolicy=no-referrer-when-downgrade

polkadot_omni_node_lib/nodes/
mod.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Cumulus.
3// SPDX-License-Identifier: Apache-2.0
4
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// 	http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17pub mod aura;
18mod manual_seal;
19
20use crate::common::spec::{DynNodeSpec, NodeSpec as NodeSpecT};
21use manual_seal::ManualSealNode;
22use sc_service::{Configuration, TaskManager};
23
24/// The current node version for cumulus official binaries, which takes the basic
25/// SemVer form `<major>.<minor>.<patch>`. It should correspond to the latest
26/// `polkadot` version of a stable release.
27pub const NODE_VERSION: &'static str = "1.18.5";
28
29/// Trait that extends the `DynNodeSpec` trait with manual seal related logic.
30///
31/// We need it in order to be able to access both the `DynNodeSpec` and the manual seal logic
32/// through dynamic dispatch.
33pub trait DynNodeSpecExt: DynNodeSpec {
34	fn start_manual_seal_node(
35		&self,
36		config: Configuration,
37		block_time: u64,
38	) -> sc_service::error::Result<TaskManager>;
39}
40
41impl<T> DynNodeSpecExt for T
42where
43	T: NodeSpecT + DynNodeSpec,
44{
45	#[sc_tracing::logging::prefix_logs_with("Parachain")]
46	fn start_manual_seal_node(
47		&self,
48		config: Configuration,
49		block_time: u64,
50	) -> sc_service::error::Result<TaskManager> {
51		let node = ManualSealNode::<T>::new();
52		match config.network.network_backend {
53			sc_network::config::NetworkBackendType::Libp2p =>
54				node.start_node::<sc_network::NetworkWorker<_, _>>(config, block_time),
55			sc_network::config::NetworkBackendType::Litep2p =>
56				node.start_node::<sc_network::Litep2pNetworkBackend>(config, block_time),
57		}
58	}
59}