mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Move pMiningKey init out of StartRPCThreads
This commit decouples the pMiningKey initialization and shutdown from the RPC threads. `getwork` and `getblocktemplate` rely on pMiningKey, and can also be ran from the debug window in the UI even when the RPC server is not running. Solves issue #2706.
This commit is contained in:
@@ -11,6 +11,21 @@
|
||||
using namespace json_spirit;
|
||||
using namespace std;
|
||||
|
||||
// Key used by getwork/getblocktemplate miners.
|
||||
// Allocated in InitRPCMining, free'd in ShutdownRPCMining
|
||||
static CReserveKey* pMiningKey = NULL;
|
||||
|
||||
void InitRPCMining()
|
||||
{
|
||||
// getwork/getblocktemplate mining rewards paid here:
|
||||
pMiningKey = new CReserveKey(pwalletMain);
|
||||
}
|
||||
|
||||
void ShutdownRPCMining()
|
||||
{
|
||||
delete pMiningKey; pMiningKey = NULL;
|
||||
}
|
||||
|
||||
Value getgenerate(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
|
||||
Reference in New Issue
Block a user