From 51ed9ec971614aebdbfbd9527aba365dd0afd437 Mon Sep 17 00:00:00 2001 From: Brandon Dahler Date: Sat, 13 Apr 2013 00:13:08 -0500 Subject: Cleanup code using forward declarations. Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files. --- src/rpcmining.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/rpcmining.cpp') diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index d91f26e20..5fe464da8 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -3,11 +3,21 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. + + +#include "bitcoinrpc.h" #include "chainparams.h" #include "db.h" #include "init.h" +#include "net.h" +#include "main.h" #include "miner.h" -#include "bitcoinrpc.h" +#include "wallet.h" + +#include + +#include "json/json_spirit_utils.h" +#include "json/json_spirit_value.h" using namespace json_spirit; using namespace std; @@ -51,11 +61,11 @@ Value GetNetworkHashPS(int lookup, int height) { lookup = pb->nHeight; CBlockIndex *pb0 = pb; - int64 minTime = pb0->GetBlockTime(); - int64 maxTime = minTime; + int64_t minTime = pb0->GetBlockTime(); + int64_t maxTime = minTime; for (int i = 0; i < lookup; i++) { pb0 = pb0->pprev; - int64 time = pb0->GetBlockTime(); + int64_t time = pb0->GetBlockTime(); minTime = std::min(time, minTime); maxTime = std::max(time, maxTime); } @@ -65,7 +75,7 @@ Value GetNetworkHashPS(int lookup, int height) { return 0; uint256 workDiff = pb->nChainWork - pb0->nChainWork; - int64 timeDiff = maxTime - minTime; + int64_t timeDiff = maxTime - minTime; return (boost::int64_t)(workDiff.getdouble() / timeDiff); } @@ -187,7 +197,7 @@ Value getwork(const Array& params, bool fHelp) // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; - static int64 nStart; + static int64_t nStart; static CBlockTemplate* pblocktemplate; if (pindexPrev != chainActive.Tip() || (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)) @@ -323,7 +333,7 @@ Value getblocktemplate(const Array& params, bool fHelp) // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; - static int64 nStart; + static int64_t nStart; static CBlockTemplate* pblocktemplate; if (pindexPrev != chainActive.Tip() || (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5)) -- cgit v1.2.3