diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-05-30 15:51:41 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-05-30 16:41:35 +0200 |
commit | d98bf10f23e0e633ff2ff33075a353d30bf862b4 (patch) | |
tree | 0bc8873a2c74894989dcf9dfe3b8f69696d5814b /src/rpcmining.cpp | |
parent | ba35ecc003d148527f30b4df84285add072fae90 (diff) |
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.
Diffstat (limited to 'src/rpcmining.cpp')
-rw-r--r-- | src/rpcmining.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index b8b7459634..845e7f1f9c 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -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) |