diff options
| author | Patrick Lodder <[email protected]> | 2015-07-20 15:03:02 +0200 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2015-07-20 15:03:02 +0200 |
| commit | 8cd835cddba565594f5cde2d91ee92e32bcbf2fd (patch) | |
| tree | 049698b334daf7e65af268b0da64134fd9dbbfdc /src/rpcmining.cpp | |
| parent | Merge pull request #1200 from rnicoll/1.10-auxpow-clean (diff) | |
| parent | Update Python test address and key values to match Dogecoin format. (diff) | |
| download | discoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.tar.xz discoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.zip | |
Merge pull request #1201 from rnicoll/1.10-sync
Consensus fixes
Diffstat (limited to 'src/rpcmining.cpp')
| -rw-r--r-- | src/rpcmining.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 7eee8bb05..e0ba823de 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -47,7 +47,7 @@ Value GetNetworkHashPS(int lookup, int height) { // If lookup is -1, then use blocks since last difficulty change. if (lookup <= 0) - lookup = pb->nHeight % Params().GetConsensus().DifficultyAdjustmentInterval() + 1; + lookup = pb->nHeight % Params().GetConsensus(pb->nHeight).DifficultyAdjustmentInterval() + 1; // If lookup is larger than chain, then set it to chain length. if (lookup > pb->nHeight) @@ -159,7 +159,7 @@ Value generate(const Array& params, bool fHelp) LOCK(cs_main); IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce); } - while (!CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) { + while (!CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus(nHeight))) { // Yes, there is a chance every nonce could fail to satisfy the -regtest // target -- 1 in 2^(2^32). That ain't gonna happen. ++pblock->nNonce; @@ -518,7 +518,7 @@ Value getblocktemplate(const Array& params, bool fHelp) CBlock* pblock = &pblocktemplate->block; // pointer for convenience // Update nTime - UpdateTime(pblock, Params().GetConsensus(), pindexPrev); + UpdateTime(pblock, Params().GetConsensus(pindexPrev->nHeight), pindexPrev); pblock->nNonce = 0; static const Array aCaps = boost::assign::list_of("proposal"); @@ -773,14 +773,6 @@ Value getauxblock(const Array& params, bool fHelp) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Namecoin is downloading blocks..."); - /* This should never fail, since the chain is already - past the point of merge-mining start. Check nevertheless. */ - { - LOCK(cs_main); - if (chainActive.Height() + 1 < Params().GetConsensus().nAuxpowStartHeight) - throw std::runtime_error("getauxblock method is not yet available"); - } - /* The variables below are used to keep track of created and not yet submitted auxpow blocks. Lock them, just in case. In principle there's only one RPC thread, so it should be fine without locking |