Skip to content

Comments

Add option to stop mining after finding X blocks#192

Open
ksynb wants to merge 1 commit intopooler:masterfrom
ksynb:master
Open

Add option to stop mining after finding X blocks#192
ksynb wants to merge 1 commit intopooler:masterfrom
ksynb:master

Conversation

@ksynb
Copy link

@ksynb ksynb commented May 9, 2020

This can come in handy for testing when needing to only mine a certain amount of blocks without babysitting the console

break;
case 'X':
v = atoi(arg);
if (v < -1) /* sanity check */

Choose a reason for hiding this comment

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

atoi returns 0 on failure. You may want to detect that case here.

s,
result ? "(yay!!!)" : "(booooo)");

if (accepted_count >= opt_max_blocks) {

Choose a reason for hiding this comment

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

This relies on subtleties of comparing signed and unsigned in C. You may want to make this code more explicit by doing e.g.:

    if (opt_max_blocks > 0 && accepted_count >= opt_max_blocks)

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.

2 participants