extract common relay initialization func (#392)

This commit is contained in:
Svyatoslav Nikolsky
2020-10-05 10:01:19 +03:00
committed by Bastian Köcher
parent fe2d786f13
commit 52b11a58c9
6 changed files with 77 additions and 46 deletions
+9 -5
View File
@@ -8,15 +8,19 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
async-std = "1.6.2"
async-trait = "0.1.41"
bp-rialto = { path = "../../primitives/rialto" }
codec = { package = "parity-scale-codec", version = "1.3.4" }
futures = "0.3.5"
headers-relay = { path = "../headers-relay" }
log = "0.4.11"
messages-relay = { path = "../messages-relay" }
paste = "1.0"
sp-runtime = "2.0"
structopt = "0.3"
# Bridge dependencies
bp-rialto = { path = "../../primitives/rialto" }
headers-relay = { path = "../headers-relay" }
messages-relay = { path = "../messages-relay" }
relay-millau-client = { path = "../millau-client" }
relay-rialto-client = { path = "../rialto-client" }
relay-substrate-client = { path = "../substrate-client" }
sp-runtime = "2.0"
structopt = "0.3"
relay-utils = { path = "../utils" }
+4 -1
View File
@@ -20,6 +20,7 @@
use relay_rialto_client::SigningParams as RialtoSigningParams;
use relay_substrate_client::ConnectionParams;
use relay_utils::initialize::initialize_relay;
/// Millau node client.
pub type MillauClient = relay_substrate_client::Client<relay_millau_client::Millau>;
@@ -30,6 +31,8 @@ mod cli;
mod millau_headers_to_rialto;
fn main() {
initialize_relay();
let result = async_std::task::block_on(run_command(cli::parse_args()));
if let Err(error) = result {
log::error!(target: "bridge", "Failed to start relay: {}", error);
@@ -58,7 +61,7 @@ async fn run_command(command: cli::Command) -> Result<(), String> {
rialto_sign.rialto_signer_password.as_deref(),
)
.map_err(|e| format!("Failed to parse rialto-signer: {:?}", e))?;
millau_headers_to_rialto::run(millau_client, rialto_client, rialto_sign)
millau_headers_to_rialto::run(millau_client, rialto_client, rialto_sign);
}
}