Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions src/c2pool/main_dash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,18 @@ int run_node(bool testnet, const std::string& rpc_endpoint,
// same scope). The StratumServer co-owns the work source via shared_ptr.
auto work_source = std::make_shared<dash::stratum::DASHWorkSource>(
node_coin_state, std::move(dashd_fallback), std::move(stratum_submit_fn),
core::stratum::StratumConfig{});
core::stratum::StratumConfig{}, testnet);

if (stratum_port != 0) {
stratum_server = std::make_unique<core::StratumServer>(
ioc, stratum_host, stratum_port, work_source);
if (stratum_server->start()) {
std::cout << "[run] stratum listening on " << stratum_host << ":"
<< stratum_port
<< " (work source: DASHWorkSource 4a/4b skeleton -- X11;"
<< " get_work routes to the dashd-RPC fallback until the"
<< " node-held coin-state is seeded)\n";
<< " (work source: DASHWorkSource 4c/4d -- X11 template"
<< " serving + submit scoring; templates source from the"
<< " embedded coin-state when seeded, else the retained"
<< " dashd-RPC GBT fallback)\n";
} else {
std::cout << "[run] stratum FAILED to bind " << stratum_host << ":"
<< stratum_port << " -- stratum disabled\n";
Expand Down
8 changes: 8 additions & 0 deletions src/c2pool/main_ltc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,14 @@ int main(int argc, char* argv[]) {
{
const uint64_t nofile = core::raise_nofile_limit(65536);
if (nofile == 0)
#ifdef _WIN32
// Windows has no RLIMIT_NOFILE; emit on stdout so the --help smoke
// (pwsh `2>&1 | Select-Object -First N`) never surfaces a stderr
// NativeCommandError from this benign startup notice.
std::cout << "[init] RLIMIT_NOFILE: not applicable on this platform\n";
#else
LOG_WARNING << "RLIMIT_NOFILE: unsupported on this platform (or query failed)";
#endif
else if (nofile < 65536)
LOG_WARNING << "RLIMIT_NOFILE soft limit is " << nofile
<< " (< 65536; hard limit too low — raise with ulimit -Hn / limits.conf)";
Expand Down Expand Up @@ -632,6 +639,7 @@ int main(int argc, char* argv[]) {

// Stratum tuning (configurable via CLI or YAML)
core::StratumConfig stratum_config; // defaults: min=0.0005, max=65536, target=3.0s, vardiff=true
stratum_config.coin_symbol = "LTC"; // runtime coin tag for coin-agnostic core log lines

// Operational tuning (configurable via CLI or YAML)
std::string log_file; // empty = default "debug.log"
Expand Down
12 changes: 10 additions & 2 deletions src/core/stratum_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,16 @@ void StratumSession::send_notify_work(bool force_clean, const uint256* frozen_be
auto now = std::chrono::steady_clock::now().time_since_epoch().count();
auto prev = s_last_warn.load();
if (now - prev > 30'000'000'000LL) { // 30 seconds
if (s_last_warn.compare_exchange_strong(prev, now))
LOG_WARNING << "[LTC] Waiting for block template (header sync in progress)...";
if (s_last_warn.compare_exchange_strong(prev, now)) {
// Runtime coin tag from the work-source config — this core is
// coin-agnostic and must never hardcode a coin (issue #732:
// a DASH binary logging "[LTC]" sent the operator diagnosing
// the wrong coin). Neutral fallback when unset.
const std::string& sym =
mining_interface_->get_stratum_config().coin_symbol;
LOG_WARNING << "[" << (sym.empty() ? "Stratum" : sym)
<< "] Waiting for block template (header sync in progress)...";
}
}
auto timer = std::make_shared<boost::asio::steady_timer>(socket_.get_executor());
timer->expires_after(std::chrono::seconds(1));
Expand Down
5 changes: 5 additions & 0 deletions src/core/stratum_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ struct StratumConfig {
// max_stratum_connections (YAML) / --max-stratum-connections (CLI).
// Admission control only — zero wire-byte change for admitted sessions.
size_t max_stratum_connections = 100;
// Runtime coin tag for coin-agnostic core log lines (e.g. the "waiting
// for block template" warning). Set by each coin's work source / main so
// a DASH binary never logs "[LTC]" (issue #732 secondary defect). Empty
// -> the core falls back to the neutral "[Stratum]" tag.
std::string coin_symbol;
};

/// Frozen share-construction fields returned by ref_hash_fn. These
Expand Down
3 changes: 3 additions & 0 deletions src/impl/btc/stratum/work_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ BTCWorkSource::BTCWorkSource(btc::coin::HeaderChain& chain,
// 65536x-inflated wire diff that starves low-rate SHA256d miners of
// acceptable shares. Wire-only; does not touch the share-accept target.
config_.set_difficulty_multiplier = 1.0;
// Runtime coin tag for coin-agnostic core log lines (#732).
if (config_.coin_symbol.empty())
config_.coin_symbol = "BTC";

LOG_INFO << "[BTC-STRATUM] BTCWorkSource constructed"
<< " (testnet=" << is_testnet_
Expand Down
4 changes: 2 additions & 2 deletions src/impl/dash/stratum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# capstone; only c2pool-dash (and the test_dash_stratum_work_source KAT) link the
# objects in, so ltc/btc/doge/dgb build + ctest surfaces stay untouched.
# SAFE-ADDITIVE, per-coin isolation held: src/impl/dash only, dashd RPC fallback
# preserved. Stage 4b: bodies landed (getters + registry + get_work adapter real;
# X11 work-assembly + share-validation held at safe defaults for 4c/4d).
# preserved. Stage 4c/4d (#732): template trio served off the cached
# embedded/fallback DashWorkData + X11 submit scoring live.
add_library(dash_stratum OBJECT
work_source.hpp work_source.cpp
)
Expand Down
Loading
Loading