Add sync mode to prevent mining during sidechain load

- Added m_readyToMine flag to SideChain
- Display LOADING SIDECHAIN banner at startup
- Delay stratum server and mining until sidechain sync completes
- Display MINING IS NOW ENABLED when ready
- Prevents premature mining that caused peer bans and chain splits

P2PServer starts immediately for sync, but stratum port doesn't
open until sidechain is fully loaded and after pruning completes
This commit is contained in:
Matt Hess
2025-12-09 18:52:32 +00:00
parent 36d03d19fe
commit 4a2bec3f29
3 changed files with 25 additions and 0 deletions
+9
View File
@@ -2447,6 +2447,15 @@ void SideChain::prune_old_blocks()
}
#endif
}
// If side-chain started pruning blocks it means the initial sync is complete
// It's now safe to delete cached blocks
if (!m_readyToMine.load()) {
m_readyToMine.store(true);
LOGINFO(0, log::LightGreen() << "########################################");
LOGINFO(0, log::LightGreen() << "SIDECHAIN LOADED - MINING IS NOW ENABLED");
LOGINFO(0, log::LightGreen() << "########################################");
}
}
void SideChain::get_missing_blocks(unordered_set<hash>& missing_blocks) const