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

Limit stale range #53

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/datum_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ int datum_read_config(const char *conffile) {

if (roundDownToPowerOfTwo_64(datum_config.stratum_v1_vardiff_min) != datum_config.stratum_v1_vardiff_min) {
const int nv = roundDownToPowerOfTwo_64(datum_config.stratum_v1_vardiff_min);
DLOG_WARN("stratum.stratum_v1_vardiff_min MUST be a power of two. adjusting from %d to %d", datum_config.stratum_v1_vardiff_min, nv);
DLOG_WARN("stratum.vardiff_min MUST be a power of two. adjusting from %d to %d", datum_config.stratum_v1_vardiff_min, nv);
datum_config.stratum_v1_vardiff_min = nv;
}

if (datum_config.stratum_v1_vardiff_min < 1) {
DLOG_FATAL("Stratum server stratum.stratum_v1_vardiff_min must be at least 1 (suggest at least 1024, but more likely 32768)");
DLOG_FATAL("Stratum server stratum.vardiff_min must be at least 1 (suggest at least 1024, but more likely 32768)");
return 0;
}

Expand All @@ -362,6 +362,16 @@ int datum_read_config(const char *conffile) {
return 0;
}

if (datum_config.stratum_v1_share_stale_seconds < 60) {
DLOG_FATAL("Stratum server stratum.share_stale_seconds must be at least 60 (suggest 120)");
return 0;
}

if (datum_config.stratum_v1_share_stale_seconds > 150) {
DLOG_FATAL("Stratum server stratum.share_stale_seconds must not exceed 150 (suggest 120)");
return 0;
}

if (datum_config.datum_protocol_global_timeout < (datum_config.bitcoind_work_update_seconds+5)) {
DLOG_FATAL("DATUM protocol global timeout must be at least the work update interval plus 5 seconds.");
return 0;
Expand Down
Loading