Skip to content

Commit d64d0d2

Browse files
authored
Merge pull request #484 from frstrtr/dashboard/per-coin-block-confirm-timing
web(found-blocks): per-coin block-confirmation timing (stop false orphans on slow chains)
2 parents d932b0a + d7874fe commit d64d0d2

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/core/web_server.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4334,13 +4334,23 @@ void MiningInterface::schedule_block_verification(const std::string& block_hash)
43344334
chain_name = m_found_blocks[idx].chain;
43354335
}
43364336

4337+
// Per-coin block target (seconds). Confirmation checks below are spaced by
4338+
// this value, so it MUST track each chain's real block time. Previously only
4339+
// LTC/DOGE were known and every other coin fell through to 60s -- meaning a
4340+
// genuine found block on a slow chain (BTC/BCH ~10 min) exhausted all 6
4341+
// confirmation checks inside ~1 real block and was falsely marked orphaned.
4342+
// A dashboard must never lie that a real found block was lost.
4343+
std::string cn = chain_name;
4344+
if (cn.size() > 1 && cn[0] == 't') // strip testnet prefix (tLTC, tBTC, ...)
4345+
cn = cn.substr(1);
43374346
int block_time_sec;
4338-
if (chain_name == "LTC" || chain_name == "tLTC")
4339-
block_time_sec = 150; // 2.5 minutes
4340-
else if (chain_name == "DOGE")
4341-
block_time_sec = 60; // 1 minute
4342-
else
4343-
block_time_sec = 60;
4347+
if (cn == "LTC") block_time_sec = 150; // 2.5 min
4348+
else if (cn == "DOGE") block_time_sec = 60; // 1 min
4349+
else if (cn == "BTC") block_time_sec = 600; // 10 min
4350+
else if (cn == "BCH") block_time_sec = 600; // 10 min
4351+
else if (cn == "DASH") block_time_sec = 150; // 2.5 min
4352+
else if (cn == "DGB") block_time_sec = 15; // ~15 s
4353+
else block_time_sec = 60; // safe fallback
43444354

43454355
// Check at: first_check, then every block_time for 6 blocks,
43464356
// then one final check at 10 blocks

0 commit comments

Comments
 (0)