This commit is contained in:
Michael Toutonghi
2018-05-17 22:58:30 -07:00
parent 31bbe2343f
commit f6608b5a0d
5 changed files with 17 additions and 10 deletions

View File

@@ -321,6 +321,16 @@ public:
//! Efficiently find an ancestor of this block.
CBlockIndex* GetAncestor(int height);
const CBlockIndex* GetAncestor(int height) const;
int32_t GetVerusPOSTarget() const
{
return GetBlockHeader().GetVerusPOSTarget();
}
bool IsVerusPOSBlock() const
{
return GetBlockHeader().IsVerusPOSBlock();
}
};
/** Used to marshal pointers into hashes for db storage. */

View File

@@ -1270,7 +1270,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
arith_uint256 target, hash;
CTransaction tx;
if (!pblock->isVerusPOSBlock())
if (!pblock->IsVerusPOSBlock())
return false;
char voutaddr[64],destaddr[64];

View File

@@ -6025,8 +6025,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
for (; pindex; pindex = chainActive.Next(pindex))
{
CBlockHeader h = pindex->GetBlockHeader();
printf("size.%i, solution size.%i\n", (int)sizeof(h), (int)h.nSolution.size());
printf("hash.%s prevhash.%s nonce.%s\n", h.GetHash().ToString().c_str(), h.hashPrevBlock.ToString().c_str(), h.nNonce.ToString().c_str());
//printf("size.%i, solution size.%i\n", (int)sizeof(h), (int)h.nSolution.size());
//printf("hash.%s prevhash.%s nonce.%s\n", h.GetHash().ToString().c_str(), h.hashPrevBlock.ToString().c_str(), h.nNonce.ToString().c_str());
vHeaders.push_back(pindex->GetBlockHeader());
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
break;
@@ -6196,8 +6196,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CBlockIndex *pindexLast = NULL;
BOOST_FOREACH(const CBlockHeader& header, headers) {
printf("size.%i, solution size.%i\n", (int)sizeof(header), (int)header.nSolution.size());
printf("hash.%s prevhash.%s nonce.%s\n", header.GetHash().ToString().c_str(), header.hashPrevBlock.ToString().c_str(), header.nNonce.ToString().c_str());
//printf("size.%i, solution size.%i\n", (int)sizeof(header), (int)header.nSolution.size());
//printf("hash.%s prevhash.%s nonce.%s\n", header.GetHash().ToString().c_str(), header.hashPrevBlock.ToString().c_str(), header.nNonce.ToString().c_str());
CValidationState state;
if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) {

View File

@@ -323,7 +323,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
return error("CheckProofOfWork(): nBits below minimum work");
// Check proof of work matches claimed amount
if ( UintToArith256(hash = blkHeader.GetHash()) > bnTarget && !blkHeader.isVerusPOSBlock() )
if ( UintToArith256(hash = blkHeader.GetHash()) > bnTarget && !blkHeader.IsVerusPOSBlock() )
{
if ( KOMODO_LOADINGBLOCKS != 0 )
return true;
@@ -357,7 +357,6 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
return true;
}
arith_uint256 GetBlockProof(const CBlockIndex& block)
{
arith_uint256 bnTarget;
@@ -365,8 +364,6 @@ arith_uint256 GetBlockProof(const CBlockIndex& block)
bool fOverflow;
bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow);
// TODO(miketout): proof of stake blocks must be marked as having the minimum POW in this context
if (fNegative || fOverflow || bnTarget == 0)
return 0;
// We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256

View File

@@ -104,7 +104,7 @@ public:
return nBits;
}
bool isVerusPOSBlock() const
bool IsVerusPOSBlock() const
{
arith_uint256 arNonce = UintToArith256(nNonce);
arith_uint256 tmpNonce = ((arNonce << 128) >> 128);