本文整理汇总了C++中CBlockIndex::GetProofOfBurn方法的典型用法代码示例。如果您正苦于以下问题:C++ CBlockIndex::GetProofOfBurn方法的具体用法?C++ CBlockIndex::GetProofOfBurn怎么用?C++ CBlockIndex::GetProofOfBurn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlockIndex
的用法示例。
在下文中一共展示了CBlockIndex::GetProofOfBurn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadBlockIndex
bool CTxDB::LoadBlockIndex()
{
// Get database cursor
Dbc* pcursor = GetCursor();
if (!pcursor)
return false;
// Load mapBlockIndex
unsigned int fFlags = DB_SET_RANGE;
for(;;)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
if (fFlags == DB_SET_RANGE)
ssKey << make_pair(string("blockindex"), uint256(0));
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
fFlags = DB_NEXT;
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
return false;
// Unserialize
try {
string strType;
ssKey >> strType;
if (strType == "blockindex" && !fRequestShutdown)
{
CDiskBlockIndex diskindex;
ssValue >> diskindex;
uint256 blockHash = diskindex.GetBlockHash();
// Construct block index object
CBlockIndex* pindexNew = InsertBlockIndex(blockHash);
pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev);
pindexNew->pnext = InsertBlockIndex(diskindex.hashNext);
pindexNew->nFile = diskindex.nFile;
pindexNew->nBlockPos = diskindex.nBlockPos;
pindexNew->nHeight = diskindex.nHeight;
pindexNew->nMint = diskindex.nMint;
pindexNew->nMoneySupply = diskindex.nMoneySupply;
pindexNew->nFlags = diskindex.nFlags;
pindexNew->nStakeModifier = diskindex.nStakeModifier;
pindexNew->prevoutStake = diskindex.prevoutStake;
pindexNew->nStakeTime = diskindex.nStakeTime;
pindexNew->hashProofOfStake = diskindex.hashProofOfStake;
pindexNew->nVersion = diskindex.nVersion;
pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot;
pindexNew->nTime = diskindex.nTime;
pindexNew->nBits = diskindex.nBits;
pindexNew->nNonce = diskindex.nNonce;
//Load Proof of Burn switch and indexes
pindexNew->fProofOfBurn = diskindex.fProofOfBurn;
pindexNew->burnHash = diskindex.burnHash;
pindexNew->burnBlkHeight = diskindex.burnBlkHeight;
pindexNew->burnCTx = diskindex.burnCTx;
pindexNew->burnCTxOut = diskindex.burnCTxOut;
pindexNew->nEffectiveBurnCoins = diskindex.nEffectiveBurnCoins;
pindexNew->nBurnBits = diskindex.nBurnBits;
// Watch for genesis block
if (pindexGenesisBlock == NULL && blockHash == hashGenesisBlock)
pindexGenesisBlock = pindexNew;
if (!pindexNew->CheckIndex())
return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight);
// ppcoin: build setStakeSeen
if (pindexNew->IsProofOfStake())
setStakeSeen.insert(make_pair(pindexNew->prevoutStake, pindexNew->nStakeTime));
else if(pindexNew->IsProofOfBurn()) //build the setBurnSeen
setBurnSeen.insert(pindexNew->GetProofOfBurn());
}
else
{
break; // if shutdown requested or finished loading block index
}
} // try
catch (std::exception &e) {