ipc mining: Prevent `Assertion m_node.chainman' failed`` errors on early startup

This fixes ``Assertion `m_node.chainman' failed`` errors first reported
https://github.com/bitcoin/bitcoin/issues/33994#issuecomment-3602551596 when
IPC mining methods are called before ChainstateManager is loaded.

The fix works by making the `Init.makeMining` method block until chainstate
data is loaded.
This commit is contained in:
Ryan Ofsky
2026-02-24 08:31:38 -05:00
parent a7cabf92e4
commit bbc8f1e0a7
6 changed files with 52 additions and 5 deletions

View File

@@ -1207,7 +1207,9 @@ bool AppInitLockDirectories()
bool AppInitInterfaces(NodeContext& node)
{
node.chain = interfaces::MakeChain(node);
node.mining = interfaces::MakeMining(node);
// Specify wait_loaded=false so internal mining interface can be initialized
// on early startup and does not need to be tied to chainstate loading.
node.mining = interfaces::MakeMining(node, /*wait_loaded=*/false);
return true;
}