Skip to content

Commit

Permalink
Allow dev accounts to be used as miners
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d committed May 29, 2024
1 parent 13b7b62 commit e100072
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ sp-core = { branch = "release-polkadot-v1.5.0", default-features = false, git =
sp-genesis-builder = { branch = "release-polkadot-v1.5.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk" }
sp-inherents = { branch = "release-polkadot-v1.5.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk" }
sp-io = { branch = "release-polkadot-v1.5.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk" }
sp-keyring = { branch = "release-polkadot-v1.5.0", git = "https://github.com/paritytech/polkadot-sdk" }
sp-keystore = { branch = "release-polkadot-v1.5.0", git = "https://github.com/paritytech/polkadot-sdk" }
sp-offchain = { branch = "release-polkadot-v1.5.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk" }
sp-runtime = { branch = "release-polkadot-v1.5.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk" }
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ sp-consensus = { workspace = true }
sp-consensus-pow = { workspace = true }
sp-core = { workspace = true }
sp-inherents = { workspace = true }
sp-keyring = { workspace = true }
sp-runtime = { workspace = true }
sp-timestamp = { workspace = true }
sp-transaction-pool = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ pub struct AcademyPowCli {
}

impl AcademyPowCli {
pub fn public_key_bytes(&self) -> [u8; 32] {
pub fn public_key_bytes(&self, keyring: Option<sp_keyring::Sr25519Keyring>) -> [u8; 32] {
match &self.mining_account_id {
Some(account_id) => *account_id.as_ref(),
None => match self.mining_public_key {
Some(public_key) => public_key.0,
None => [0u8; 32],
None => keyring.map(|k| k.to_raw_public()).unwrap_or([0u8; 32]),
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn run() -> sc_cli::Result<()> {
}
None => {
// Get the mining account from the cli
let bytes: [u8; 32] = cli.pow.public_key_bytes();
let bytes: [u8; 32] = cli.pow.public_key_bytes(cli.run.get_keyring());
let sr25519_public_key = Public(bytes);

let runner = cli.create_runner(&cli.run)?;
Expand Down

0 comments on commit e100072

Please sign in to comment.