cleanup
This commit is contained in:
10
src/chain.h
10
src/chain.h
@@ -321,6 +321,16 @@ public:
|
|||||||
//! Efficiently find an ancestor of this block.
|
//! Efficiently find an ancestor of this block.
|
||||||
CBlockIndex* GetAncestor(int height);
|
CBlockIndex* GetAncestor(int height);
|
||||||
const CBlockIndex* GetAncestor(int height) const;
|
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. */
|
/** Used to marshal pointers into hashes for db storage. */
|
||||||
|
|||||||
@@ -1270,7 +1270,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
|
|||||||
arith_uint256 target, hash;
|
arith_uint256 target, hash;
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
|
|
||||||
if (!pblock->isVerusPOSBlock())
|
if (!pblock->IsVerusPOSBlock())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char voutaddr[64],destaddr[64];
|
char voutaddr[64],destaddr[64];
|
||||||
|
|||||||
@@ -6025,8 +6025,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
for (; pindex; pindex = chainActive.Next(pindex))
|
for (; pindex; pindex = chainActive.Next(pindex))
|
||||||
{
|
{
|
||||||
CBlockHeader h = pindex->GetBlockHeader();
|
CBlockHeader h = pindex->GetBlockHeader();
|
||||||
printf("size.%i, solution size.%i\n", (int)sizeof(h), (int)h.nSolution.size());
|
//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("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());
|
vHeaders.push_back(pindex->GetBlockHeader());
|
||||||
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
|
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
|
||||||
break;
|
break;
|
||||||
@@ -6196,8 +6196,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
|
|
||||||
CBlockIndex *pindexLast = NULL;
|
CBlockIndex *pindexLast = NULL;
|
||||||
BOOST_FOREACH(const CBlockHeader& header, headers) {
|
BOOST_FOREACH(const CBlockHeader& header, headers) {
|
||||||
printf("size.%i, solution size.%i\n", (int)sizeof(header), (int)header.nSolution.size());
|
//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("hash.%s prevhash.%s nonce.%s\n", header.GetHash().ToString().c_str(), header.hashPrevBlock.ToString().c_str(), header.nNonce.ToString().c_str());
|
||||||
|
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) {
|
if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) {
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
|||||||
return error("CheckProofOfWork(): nBits below minimum work");
|
return error("CheckProofOfWork(): nBits below minimum work");
|
||||||
|
|
||||||
// Check proof of work matches claimed amount
|
// 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 )
|
if ( KOMODO_LOADINGBLOCKS != 0 )
|
||||||
return true;
|
return true;
|
||||||
@@ -357,7 +357,6 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
arith_uint256 GetBlockProof(const CBlockIndex& block)
|
arith_uint256 GetBlockProof(const CBlockIndex& block)
|
||||||
{
|
{
|
||||||
arith_uint256 bnTarget;
|
arith_uint256 bnTarget;
|
||||||
@@ -365,8 +364,6 @@ arith_uint256 GetBlockProof(const CBlockIndex& block)
|
|||||||
bool fOverflow;
|
bool fOverflow;
|
||||||
bnTarget.SetCompact(block.nBits, &fNegative, &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)
|
if (fNegative || fOverflow || bnTarget == 0)
|
||||||
return 0;
|
return 0;
|
||||||
// We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
|
// We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
return nBits;
|
return nBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isVerusPOSBlock() const
|
bool IsVerusPOSBlock() const
|
||||||
{
|
{
|
||||||
arith_uint256 arNonce = UintToArith256(nNonce);
|
arith_uint256 arNonce = UintToArith256(nNonce);
|
||||||
arith_uint256 tmpNonce = ((arNonce << 128) >> 128);
|
arith_uint256 tmpNonce = ((arNonce << 128) >> 128);
|
||||||
|
|||||||
Reference in New Issue
Block a user