uint64 nChainTrust;// ppcoin: trust score of chain, in the unit of coin-days
int nHeight;
int nCheckpoint; // ppcoin: chain auto checkpoint height
+ bool fProofOfStake; // ppcoin: is the block of proof-of-stake type
// block header
int nVersion;
nHeight = 0;
nChainTrust = 0;
nCheckpoint = 0;
+ fProofOfStake = true;
nVersion = 0;
hashMerkleRoot = 0;
nHeight = 0;
nChainTrust = 0;
nCheckpoint = 0;
+ fProofOfStake = block.IsProofOfStake();
nVersion = block.nVersion;
hashMerkleRoot = block.hashMerkleRoot;
return pindex->GetMedianTimePast();
}
+ bool IsProofOfWork() const
+ {
+ return !fProofOfStake;
+ }
+ bool IsProofOfStake() const
+ {
+ return fProofOfStake;
+ }
std::string ToString() const
{
- return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nChainTrust=%"PRI64d" nHeight=%d, nCheckpoint=%d, merkle=%s, hashBlock=%s)",
- pprev, pnext, nFile, nBlockPos, nChainTrust, nHeight, nCheckpoint,
+ return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nChainTrust=%"PRI64d" nHeight=%d, nCheckpoint=%d, fProofOfStake=%d merkle=%s, hashBlock=%s)",
+ pprev, pnext, nFile, nBlockPos, nChainTrust, nHeight, nCheckpoint, fProofOfStake,
hashMerkleRoot.ToString().substr(0,10).c_str(),
GetBlockHash().ToString().substr(0,20).c_str());
}
READWRITE(nChainTrust);
READWRITE(nHeight);
READWRITE(nCheckpoint);
+ READWRITE(fProofOfStake);
// block header
READWRITE(this->nVersion);