staking-miner: remove need of a file to pass the seed (#3680)

* staking-miner: remove need of a file to pass the seed

* cleanup

* linting round

* fix linting

* fix naming and remove unused field
This commit is contained in:
Chevdor
2021-08-27 11:29:17 +02:00
committed by GitHub
parent 07301bd693
commit 47c75122d1
6 changed files with 26 additions and 29 deletions
+8 -8
View File
@@ -276,15 +276,15 @@ struct DryRunConfig {
#[derive(Debug, Clone, StructOpt)]
struct SharedConfig {
/// The `ws` node to connect to.
#[structopt(long, short, default_value = DEFAULT_URI)]
#[structopt(long, short, default_value = DEFAULT_URI, env = "URI")]
uri: String,
/// The file from which we read the account seed.
/// The seed of a funded account in hex.
///
/// WARNING: don't use an account with a large stash for this. Based on how the bot is
/// configured, it might re-try lose funds through transaction fees/deposits.
#[structopt(long, short)]
account_seed: std::path::PathBuf,
/// WARNING: Don't use an account with a large stash for this. Based on how the bot is
/// configured, it might re-try and lose funds through transaction fees/deposits.
#[structopt(long, short, env = "SEED")]
seed: String,
}
#[derive(Debug, Clone, StructOpt)]
@@ -354,7 +354,7 @@ fn mine_dpos<T: EPM::Config>(ext: &mut Ext) -> Result<(), Error> {
let desired_targets = EPM::DesiredTargets::<T>::get().unwrap();
let mut candidates_and_backing = BTreeMap::<T::AccountId, u128>::new();
voters.into_iter().for_each(|(who, stake, targets)| {
if targets.len() == 0 {
if targets.is_empty() {
println!("target = {:?}", (who, stake, targets));
return
}
@@ -491,7 +491,7 @@ async fn main() {
};
let signer_account = any_runtime! {
signer::read_signer_uri::<_, Runtime>(&shared.account_seed, &client)
signer::signer_uri_from_string::<Runtime>(&shared.seed, &client)
.await
.expect("Provided account is invalid, terminating.")
};