More nonce and new PoS reporting improvements
This commit is contained in:
@@ -1303,7 +1303,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
|
||||
else
|
||||
{
|
||||
CBlockHeader bh = pastBlockIndex->GetBlockHeader();
|
||||
uint256 pastHash = bh.GetVerusEntropyHash(height);
|
||||
uint256 pastHash = bh.GetVerusEntropyHash(height - 100);
|
||||
|
||||
// if height is over when Nonce is required to be the new format, we check that the new format is correct
|
||||
// if over when we have the new POS hash function, we validate that as well
|
||||
|
||||
@@ -804,6 +804,18 @@ int32_t waitForPeers(const CChainParams &chainparams)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
CBlockIndex *get_chainactive(int32_t height)
|
||||
{
|
||||
if ( chainActive.Tip() != 0 )
|
||||
{
|
||||
if ( height <= chainActive.Tip()->nHeight )
|
||||
return(chainActive[height]);
|
||||
// else fprintf(stderr,"get_chainactive height %d > active.%d\n",height,chainActive.Tip()->nHeight);
|
||||
}
|
||||
//fprintf(stderr,"get_chainactive null chainActive.Tip() height %d\n",height);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* A separate thread to stake, while the miner threads mine.
|
||||
*/
|
||||
@@ -959,7 +971,9 @@ void static VerusStaker(CWallet *pwallet)
|
||||
printf("staking reward %.8f %s!\n", (double)subsidy / (double)COIN, ASSETCHAINS_SYMBOL);
|
||||
arith_uint256 post;
|
||||
post.SetCompact(pblock->GetVerusPOSTarget());
|
||||
printf(" hash: %s \ntarget: %s\n", pblock->vtx[pblock->vtx.size()-1].GetVerusPOSHash(&(pblock->nNonce), 0, Mining_height, pindexPrev->GetBlockHeader().GetVerusEntropyHash(Mining_height)).GetHex().c_str(), ArithToUint256(post).GetHex().c_str());
|
||||
pindexPrev = get_chainactive(Mining_height - 100);
|
||||
printf(" hash: %s \ntarget: %s\n",
|
||||
CTransaction::_GetVerusPOSHash(&(pblock->nNonce), pblock->vtx[pblock->vtx.size()-1].vin[0].prevout.hash, 0, Mining_height, pindexPrev->GetBlockHeader().GetVerusEntropyHash(Mining_height - 100), pblock->vtx[pblock->vtx.size()-1].vout[0].nValue).GetHex().c_str(), ArithToUint256(post).GetHex().c_str());
|
||||
if (unlockTime > Mining_height && subsidy >= ASSETCHAINS_TIMELOCKGTE)
|
||||
printf("- timelocked until block %i\n", unlockTime);
|
||||
else
|
||||
|
||||
@@ -65,7 +65,7 @@ bool CBlockHeader::GetRawVerusPOSHash(uint256 &value, int32_t nHeight) const
|
||||
// )
|
||||
// hashWriter << height;
|
||||
// return hashWriter.GetHash();
|
||||
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
|
||||
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
|
||||
|
||||
hashWriter << ASSETCHAINS_MAGIC;
|
||||
hashWriter << nNonce;
|
||||
|
||||
@@ -1016,7 +1016,7 @@ bool CWallet::VerusSelectStakeOutput(CBlock *pBlock, arith_uint256 &hashResult,
|
||||
if (pastBlockIndex = komodo_chainactive(nHeight - 100))
|
||||
{
|
||||
CBlockHeader bh = pastBlockIndex->GetBlockHeader();
|
||||
uint256 pastHash = bh.GetVerusEntropyHash(nHeight);
|
||||
uint256 pastHash = bh.GetVerusEntropyHash(nHeight - 100);
|
||||
CPOSNonce curNonce;
|
||||
|
||||
BOOST_FOREACH(COutput &txout, vecOutputs)
|
||||
|
||||
Reference in New Issue
Block a user