void SetNull() { nFile = -1; nPos = 0; }
bool IsNull() const { return (nFile == -1); }
+
+ std::string ToString() const
+ {
+ return strprintf("CBlockDiskPos(nFile=%i, nPos=%i)", nFile, nPos);
+ }
+
};
enum BlockStatus {
*/
BLOCK_VALID_TRANSACTIONS = 3,
- //! Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30.
+ //! Outputs do not overspend inputs, no double spends, coinbase output ok, no immature coinbase spends, BIP30.
//! Implies all parents are also at least CHAIN.
BLOCK_VALID_CHAIN = 4,
//! Verification status of this block. See enum BlockStatus
unsigned int nStatus;
+ //! The anchor for the tree state up to the start of this block
+ uint256 hashAnchor;
+
//! block header
int nVersion;
uint256 hashMerkleRoot;
+ uint256 hashReserved;
unsigned int nTime;
unsigned int nBits;
- unsigned int nNonce;
+ uint256 nNonce;
+ std::vector<unsigned char> nSolution;
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
uint32_t nSequenceId;
nTx = 0;
nChainTx = 0;
nStatus = 0;
+ hashAnchor = uint256();
nSequenceId = 0;
nVersion = 0;
hashMerkleRoot = uint256();
+ hashReserved = uint256();
nTime = 0;
nBits = 0;
- nNonce = 0;
+ nNonce = uint256();
+ nSolution.clear();
}
CBlockIndex()
nVersion = block.nVersion;
hashMerkleRoot = block.hashMerkleRoot;
+ hashReserved = block.hashReserved;
nTime = block.nTime;
nBits = block.nBits;
nNonce = block.nNonce;
+ nSolution = block.nSolution;
}
CDiskBlockPos GetBlockPos() const {
if (pprev)
block.hashPrevBlock = pprev->GetBlockHash();
block.hashMerkleRoot = hashMerkleRoot;
+ block.hashReserved = hashReserved;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
+ block.nSolution = nSolution;
return block;
}
READWRITE(VARINT(nDataPos));
if (nStatus & BLOCK_HAVE_UNDO)
READWRITE(VARINT(nUndoPos));
+ READWRITE(hashAnchor);
// block header
READWRITE(this->nVersion);
READWRITE(hashPrev);
READWRITE(hashMerkleRoot);
+ READWRITE(hashReserved);
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
+ READWRITE(nSolution);
}
uint256 GetBlockHash() const
block.nVersion = nVersion;
block.hashPrevBlock = hashPrev;
block.hashMerkleRoot = hashMerkleRoot;
+ block.hashReserved = hashReserved;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
+ block.nSolution = nSolution;
return block.GetHash();
}