]> Git Repo - VerusCoin.git/blobdiff - src/chain.h
Build fix
[VerusCoin.git] / src / chain.h
index 09771ee448f1c15d37480a0638fa70b0b0b79460..961afe6c40e776b89f43c9caeda5eb7b24941419 100644 (file)
@@ -251,6 +251,9 @@ class CChainPower
         {
             return !(p1 < p2);
         }
+
+        uint256 CompactChainPower() const;
+        static CChainPower ExpandCompactPower(uint256 compactPower, uint32_t height = 0);
 };
 
 /** The block chain is a tree shaped structure starting with the
@@ -655,12 +658,24 @@ public:
         return block.GetHash();
     }
 
-
     std::string ToString() const
     {
-        std::string str = "CDiskBlockIndex(";
-        str += strprintf("nVersion=%x, pprev=%p, nHeight=%d, merkle=%s\nhashBlock=%s, hashPrev=%s)\n",
-            this->nVersion, pprev, this->chainPower.nHeight, hashMerkleRoot.ToString(), GetBlockHash().ToString(), hashPrev.ToString());
+        std::string str = "CDiskBlockIndex:\n";
+
+        CBlockHeader block;
+        block.nVersion        = nVersion;
+        block.hashPrevBlock   = hashPrev;
+        block.hashMerkleRoot  = hashMerkleRoot;
+        block.hashFinalSaplingRoot    = hashFinalSaplingRoot;
+        block.nTime           = nTime;
+        block.nBits           = nBits;
+        block.nNonce          = nNonce;
+        block.nSolution       = nSolution;
+        CPBaaSPreHeader preBlock(block);
+
+        str += strprintf("block.nVersion=%x\npprev=%p\nnHeight=%d\nhashBlock=%s\nblock.hashPrevBlock=%s\nblock.hashMerkleRoot=%s\nblock.nBits=%d\nblock.nNonce=%s\nblock.nSolution=%s\npreBlock.hashPrevMMRRoot=%s\npreBlock.hashBlockMMRRoot=%s\n",
+            this->nVersion, pprev, this->chainPower.nHeight, GetBlockHash().ToString(), hashPrev.ToString(), hashMerkleRoot.ToString(), nBits, nNonce.ToString(), HexBytes(nSolution.data(), nSolution.size()), preBlock.hashPrevMMRRoot.ToString(), preBlock.hashBlockMMRRoot.ToString());
+
         return str;
     }
 };
@@ -734,7 +749,7 @@ public:
 
     /** Efficiently check whether a block is present in this chain. */
     bool Contains(const CBlockIndex *pindex) const {
-        return (*this)[pindex->GetHeight()] == pindex;
+        return !pindex ? false : (*this)[pindex->GetHeight()] == pindex;
     }
 
     /** Find the successor of a block in this chain, or NULL if the given index is not found or is the tip. */
@@ -765,6 +780,4 @@ public:
     const CBlockIndex *FindFork(const CBlockIndex *pindex) const;
 };
 
-CChainPower ExpandCompactPower(uint256 compactPower, uint32_t height = 0);
-
 #endif // BITCOIN_CHAIN_H
This page took 0.022996 seconds and 4 git commands to generate.