Skip to content

Commit

Permalink
Merge pull request #17 from navcoindev/#10-unexpected-block-version-w…
Browse files Browse the repository at this point in the history
…arning

#10 unexpected block version warning
  • Loading branch information
proletesseract committed Mar 2, 2017
2 parents 5bd14af + 5e31db9 commit 8495301
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7652,7 +7652,7 @@ static bool CheckStakeKernelHashV2(CBlockIndex* pindexPrev, unsigned int nBits,

// Now check if proof-of-stake hash meets target protocol
if (CBigNum(ArithToUint256(hashProofOfStake)) > bnTarget)
return error("CheckStakeKernelHash() : Hash %s does not meet target %s",hashProofOfStake.GetHex(),bnTarget.GetHex());
return false;

if (fDebug && !fPrintProofOfStake)
{
Expand Down
40 changes: 6 additions & 34 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bo
pblock->nVersion = 0x7;
pblocktemplate->vTxSigOpsCost[0] = WITNESS_SCALE_FACTOR * GetLegacySigOpCount(pblock->vtx[0]);

CValidationState state;
if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false, false)) {
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state)));
}

if (pFees)
*pFees = nFees;

Expand Down Expand Up @@ -630,29 +625,6 @@ void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned
// Internal Staker
//

// static bool ProcessBlockFound(const CBlock* pblock, const CChainParams& chainparams)
// {
// LogPrintf("%s\n", pblock->ToString());
// // LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue));
//
// // Found a solution
// {
// LOCK(cs_main);
// if (pblock->hashPrevBlock != chainActive.Tip()->GetBlockHash())
// return error("NavCoinStaker: generated block is stale");
// }
//
// // Inform about the new block
// GetMainSignals().BlockFound(pblock->GetHash());
//
// // Process this block the same as if we had received it from another node
// CValidationState state;
// if (!ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL))
// return error("NavCoinStaker: ProcessNewBlock, block not accepted");
//
// return true;
// }

extern unsigned int nMinerSleep;

void static NavCoinStaker(const CChainParams& chainparams)
Expand Down Expand Up @@ -855,12 +827,12 @@ bool CheckStake(CBlock* pblock, CWallet& wallet, const CChainParams& chainparams
wallet.mapRequestCount[hashBlock] = 0;
}

// GetMainSignals().BlockFound(pblock->GetHash());
//
// // Process this block the same as if we had received it from another node
// CValidationState state;
// if (!ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL))
// return error("NavCoinStaker: ProcessNewBlock, block not accepted");
GetMainSignals().BlockFound(pblock->GetHash());

// Process this block the same as if we had received it from another node
CValidationState state;
if (!ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL))
return error("NavCoinStaker: ProcessNewBlock, block not accepted");
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/versionbits.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <map>

/** What block version to use for new blocks (pre versionbits) */
static const int32_t VERSIONBITS_LAST_OLD_BLOCK_VERSION = 4;
static const int32_t VERSIONBITS_LAST_OLD_BLOCK_VERSION = 7;
/** What bits to set in version for versionbits blocks */
static const int32_t VERSIONBITS_TOP_BITS = 0x20000000UL;
/** What bitmask determines whether versionbits is in use */
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ bool CWallet::SelectCoinsForStaking(int64_t nTargetValue, unsigned int nSpendTim
bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, int64_t nFees, CTransaction& txNew, CKey& key)
{
CBlockIndex* pindexPrev = pindexBestHeader;
arith_uint256 bnTargetPerCoinDay;
CBigNum bnTargetPerCoinDay;
bnTargetPerCoinDay.SetCompact(nBits);

txNew.vin.clear();
Expand Down

0 comments on commit 8495301

Please sign in to comment.