Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If miner has no mining key set, automatically set it to node seed #5498

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ASuciuX
Copy link
Contributor

@ASuciuX ASuciuX commented Nov 22, 2024

Also, if node.seed is specified, the miner will use that as the miner.mining_key.

Tested using stacks-regtest-env.

@ASuciuX ASuciuX requested review from a team as code owners November 22, 2024 21:37
@ASuciuX ASuciuX changed the base branch from master to develop November 22, 2024 21:37
@@ -2546,6 +2551,13 @@ pub struct MinerConfigFile {

impl MinerConfigFile {
fn into_config_default(self, miner_default_config: MinerConfig) -> Result<MinerConfig, String> {
match &self.mining_key {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as a node.seed is set up, this will never trigger. Should it be removed? Or do we prefer this and remove the mining-key being automatically set?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if node.seed isn't configured and the node doesn't have miner.seed = true - will this cause the node to panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it using stacks-regtest-env for the config with

  1. node.miner = false and node.seed empty with miner config data in it
  2. node.miner = false and node.seed empty without miner config in it specified.
  3. node.miner = true and node.seed specified
  4. node.miner = true and miner.mining_key specified
    On all these cases it didn't panic.

It only panicked when node.miner = true and node.seed and miner.mining_key were not provided.

@obycode obycode requested a review from jbencin November 22, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Miner should panic if mining_key is not set
2 participants