aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bitcoinrpc.cpp9
-rw-r--r--src/bitcoinrpc.h2
-rw-r--r--src/clientversion.h2
-rw-r--r--src/init.cpp3
-rw-r--r--src/qt/locale/bitcoin_ar.ts2
-rw-r--r--src/rpcmining.cpp9
-rw-r--r--src/util.h2
7 files changed, 20 insertions, 9 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index a9b73fd5a6..2c4744a579 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -30,6 +30,10 @@ using namespace boost;
using namespace boost::asio;
using namespace json_spirit;
+// Key used by getwork/getblocktemplate miners.
+// Allocated in StartRPCThreads, free'd in StopRPCThreads
+CReserveKey* pMiningKey = NULL;
+
static std::string strRPCUserColonPass;
// These are created by StartRPCThreads, destroyed in StopRPCThreads
@@ -722,6 +726,9 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol,
void StartRPCThreads()
{
+ // getwork/getblocktemplate mining rewards paid here:
+ pMiningKey = new CReserveKey(pwalletMain);
+
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
if ((mapArgs["-rpcpassword"] == "") ||
(mapArgs["-rpcuser"] == mapArgs["-rpcpassword"]))
@@ -841,6 +848,8 @@ void StartRPCThreads()
void StopRPCThreads()
{
+ delete pMiningKey; pMiningKey = NULL;
+
if (rpc_io_service == NULL) return;
rpc_io_service->stop();
diff --git a/src/bitcoinrpc.h b/src/bitcoinrpc.h
index 315fd92383..cf5b137988 100644
--- a/src/bitcoinrpc.h
+++ b/src/bitcoinrpc.h
@@ -11,6 +11,7 @@
#include <map>
class CBlockIndex;
+class CReserveKey;
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
@@ -122,6 +123,7 @@ public:
};
extern const CRPCTable tableRPC;
+extern CReserveKey* pMiningKey;
extern int64 nWalletUnlockTime;
extern int64 AmountFromValue(const json_spirit::Value& value);
diff --git a/src/clientversion.h b/src/clientversion.h
index aabab4c726..e4fd6a69f8 100644
--- a/src/clientversion.h
+++ b/src/clientversion.h
@@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 2
-#define CLIENT_VERSION_BUILD 1
+#define CLIENT_VERSION_BUILD 2
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
diff --git a/src/init.cpp b/src/init.cpp
index 3eb090ac0c..767d7525a6 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -100,7 +100,8 @@ void Shutdown()
StopNode();
{
LOCK(cs_main);
- pwalletMain->SetBestChain(CBlockLocator(pindexBest));
+ if (pwalletMain)
+ pwalletMain->SetBestChain(CBlockLocator(pindexBest));
if (pblocktree)
pblocktree->Flush();
if (pcoinsTip)
diff --git a/src/qt/locale/bitcoin_ar.ts b/src/qt/locale/bitcoin_ar.ts
index 028080d545..741a25a4da 100644
--- a/src/qt/locale/bitcoin_ar.ts
+++ b/src/qt/locale/bitcoin_ar.ts
@@ -38,7 +38,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
- <translation>كتاب العنوانين</translation>
+ <translation>دفتر العناوين</translation>
</message>
<message>
<location line="+19"/>
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index fddda8b5f4..b8b7459634 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -104,7 +104,6 @@ Value getwork(const Array& params, bool fHelp)
typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
static mapNewBlock_t mapNewBlock; // FIXME: thread safety
static vector<CBlockTemplate*> vNewBlockTemplate;
- static CReserveKey reservekey(pwalletMain);
if (params.size() == 0)
{
@@ -134,7 +133,7 @@ Value getwork(const Array& params, bool fHelp)
nStart = GetTime();
// Create new block
- pblocktemplate = CreateNewBlock(reservekey);
+ pblocktemplate = CreateNewBlock(*pMiningKey);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
vNewBlockTemplate.push_back(pblocktemplate);
@@ -192,7 +191,7 @@ Value getwork(const Array& params, bool fHelp)
pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
- return CheckWork(pblock, *pwalletMain, reservekey);
+ return CheckWork(pblock, *pwalletMain, *pMiningKey);
}
}
@@ -243,8 +242,6 @@ Value getblocktemplate(const Array& params, bool fHelp)
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Bitcoin is downloading blocks...");
- static CReserveKey reservekey(pwalletMain);
-
// Update block
static unsigned int nTransactionsUpdatedLast;
static CBlockIndex* pindexPrev;
@@ -267,7 +264,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
delete pblocktemplate;
pblocktemplate = NULL;
}
- pblocktemplate = CreateNewBlock(reservekey);
+ pblocktemplate = CreateNewBlock(*pMiningKey);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
diff --git a/src/util.h b/src/util.h
index 3d25364505..51a694483a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -7,6 +7,8 @@
#include "uint256.h"
+#include <stdarg.h>
+
#ifndef WIN32
#include <sys/types.h>
#include <sys/time.h>