From d8422944565c78278cfd802d9a0386de7070ff1d Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Mon, 6 Jun 2022 14:55:31 +0100 Subject: [PATCH] Add licende headers and fix some grumbles --- utils/staking-miner/src/info.rs | 22 +++++++++++++++++++++- utils/staking-miner/src/main.rs | 4 ++-- utils/staking-miner/src/opts.rs | 16 ++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/utils/staking-miner/src/info.rs b/utils/staking-miner/src/info.rs index f3bb6d349612..5662c20be3f3 100644 --- a/utils/staking-miner/src/info.rs +++ b/utils/staking-miner/src/info.rs @@ -1,3 +1,21 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use sp_version::RuntimeVersion; + #[derive(Debug, serde::Serialize)] pub(crate) struct Info { pub spec_name: String, @@ -5,7 +23,9 @@ pub(crate) struct Info { } impl Info { - pub fn new(spec_name: String, spec_version: u32) -> Self { + pub fn new(runtime_version: &RuntimeVersion) -> Self { + let spec_name = runtime_version.spec_name.to_string(); + let spec_version = runtime_version.spec_version; Self { spec_name, spec_version } } } diff --git a/utils/staking-miner/src/main.rs b/utils/staking-miner/src/main.rs index d515ac997dd6..959db739deec 100644 --- a/utils/staking-miner/src/main.rs +++ b/utils/staking-miner/src/main.rs @@ -535,8 +535,8 @@ async fn main() { }), Command::Info(_info_opts) => { let runtime_version: RuntimeVersion = rpc.runtime_version(None).await.expect("runtime_version infallible; qed."); - let info = Info::new(runtime_version.spec_name.to_string(), runtime_version.spec_version); - let info = serde_json::to_string_pretty(&info).expect("Failed serializing infos"); + let info = Info::new(&runtime_version); + let info = serde_json::to_string_pretty(&info).expect("Failed serializing version info"); println!("{}", info); Ok(()) } diff --git a/utils/staking-miner/src/opts.rs b/utils/staking-miner/src/opts.rs index 67e7153f3aae..d96a613b7bb0 100644 --- a/utils/staking-miner/src/opts.rs +++ b/utils/staking-miner/src/opts.rs @@ -1,3 +1,19 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + use crate::prelude::*; use clap::Parser; use sp_runtime::Perbill;