Browse Source

Display proper POS difficulty on minted block. Add missing curly brace.

pull/4/head
Michael Toutonghi 6 years ago
parent
commit
b9956efcb4
  1. 17
      src/miner.cpp
  2. 2
      src/pow.cpp

17
src/miner.cpp

@ -897,7 +897,6 @@ void static VerusStaker(CWallet *pwallet)
return;
}
CBlock *pblock = &pblocktemplate->block;
LogPrintf("Staking with %u transactions in block (%u bytes)\n", pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
//
@ -941,22 +940,24 @@ void static VerusStaker(CWallet *pwallet)
uint256 hashTarget = ArithToUint256(arith_uint256().SetCompact(pblock->nBits));
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
ProcessBlockFound(pblock, *pwallet, reservekey);
LogPrintf("Using %s algorithm:\n", ASSETCHAINS_ALGORITHMS[ASSETCHAINS_ALGO]);
LogPrintf("Staked block found \n hash: %s \ntarget: %s\n", pblock->GetHash().GetHex(), hashTarget.GetHex());
printf("Found block %d \n", Mining_height );
printf("staking reward %.8f %s!\n", (double)subsidy / (double)COIN, ASSETCHAINS_SYMBOL);
printf(" hash: %s \ntarget: %s\n", pblock->GetHash().GetHex().c_str(), hashTarget.GetHex().c_str());
arith_uint256 post;
post.SetCompact(pblock->GetVerusPOSTarget());
printf(" hash: %s \ntarget: %s\n", pblock->vtx[pblock->vtx.size()-1].GetVerusPOSHash(0, Mining_height, pindexPrev->GetBlockHash()).GetHex().c_str(), ArithToUint256(post).GetHex().c_str());
if (unlockTime > Mining_height && subsidy >= ASSETCHAINS_TIMELOCKGTE)
printf("- timelocked until block %i\n", unlockTime);
else
printf("\n");
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
ProcessBlockFound(pblock, *pwallet, reservekey);
// Check for stop or if block needs to be rebuilt
boost::this_thread::interruption_point();
SetThreadPriority(THREAD_PRIORITY_LOWEST);

2
src/pow.cpp

@ -247,9 +247,11 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
{
// if this is real time, return zero
if (i == (N - 1))
{
// target of 0 (virtually impossible), if we hit max consecutive POS blocks
nextTarget.SetCompact(0);
return nextTarget.GetCompact();
}
}
st >>= 1;
}

Loading…
Cancel
Save