diff options
author | Brandon Dahler <brandon.dahler@gmail.com> | 2013-04-13 00:13:08 -0500 |
---|---|---|
committer | Brandon Dahler <brandon.dahler@gmail.com> | 2013-11-10 09:36:28 -0600 |
commit | 51ed9ec971614aebdbfbd9527aba365dd0afd437 (patch) | |
tree | d2f910390e55aef857023812fbdaefdd66cd99ff /src/rpcmining.cpp | |
parent | 7c4c207be8420d394a5abc4368d1bb69ad4f8067 (diff) |
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.
Diffstat (limited to 'src/rpcmining.cpp')
-rw-r--r-- | src/rpcmining.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index d91f26e20a..5fe464da81 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 <stdint.h> + +#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)) |