当前位置: 首页>>代码示例>>C++>>正文


C++ CBlock::GetBlockHeader方法代码示例

本文整理汇总了C++中CBlock::GetBlockHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ CBlock::GetBlockHeader方法的具体用法?C++ CBlock::GetBlockHeader怎么用?C++ CBlock::GetBlockHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBlock的用法示例。


在下文中一共展示了CBlock::GetBlockHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CPartialMerkleTree

CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
{
    header = block.GetBlockHeader();

    vector<bool> vMatch;
    vector<uint256> vHashes;

    vMatch.reserve(block.vtx.size());
    vHashes.reserve(block.vtx.size());

    for (unsigned int i = 0; i < block.vtx.size(); i++)
    {
        const uint256& hash = block.vtx[i].GetHash();
        if (filter.IsRelevantAndUpdate(block.vtx[i]))
        {
            vMatch.push_back(true);
            vMatchedTxn.push_back(make_pair(i, hash));
        }
        else
            vMatch.push_back(false);
        vHashes.push_back(hash);
    }

    txn = CPartialMerkleTree(vHashes, vMatch);
}
开发者ID:timelf123,项目名称:hivemind,代码行数:25,代码来源:merkleblock.cpp

示例2: if

CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids)
{
    header = block.GetBlockHeader();

    std::vector<bool> vMatch;
    std::vector<uint256> vHashes;

    vMatch.reserve(block.vtx.size());
    vHashes.reserve(block.vtx.size());

    for (unsigned int i = 0; i < block.vtx.size(); i++)
    {
        const uint256& hash = block.vtx[i]->GetHash();
        if (txids && txids->count(hash)) {
            vMatch.push_back(true);
        } else if (filter && filter->IsRelevantAndUpdate(*block.vtx[i])) {
            vMatch.push_back(true);
            vMatchedTxn.emplace_back(i, hash);
        } else {
            vMatch.push_back(false);
        }
        vHashes.push_back(hash);
    }

    txn = CPartialMerkleTree(vHashes, vMatch);
}
开发者ID:kakarott9999,项目名称:Ravencoin,代码行数:26,代码来源:merkleblock.cpp

示例3: benchmark_verify_equihash

double benchmark_verify_equihash()
{
    CChainParams params = Params(CBaseChainParams::MAIN);
    CBlock genesis = Params(CBaseChainParams::MAIN).GenesisBlock();
    CBlockHeader genesis_header = genesis.GetBlockHeader();
    struct timeval tv_start;
    timer_start(tv_start);
    CheckEquihashSolution(&genesis_header, params);
    return timer_stop(tv_start);
}
开发者ID:loxal,项目名称:zcash,代码行数:10,代码来源:zcbenchmarks.cpp

示例4: CPartialMerkleTree

CMerkleBlock::CMerkleBlock(const CBlock &block,
                           const std::set<uint256> &txids) {
    header = block.GetBlockHeader();

    std::vector<bool> vMatch;
    std::vector<uint256> vHashes;

    vMatch.reserve(block.vtx.size());
    vHashes.reserve(block.vtx.size());

    for (unsigned int i = 0; i < block.vtx.size(); i++) {
        const uint256 &txid = block.vtx[i]->GetId();
        if (txids.count(txid))
            vMatch.push_back(true);
        else
            vMatch.push_back(false);
        vHashes.push_back(txid);
    }

    txn = CPartialMerkleTree(vHashes, vMatch);
}
开发者ID:a7853z,项目名称:bitcoin-abc,代码行数:21,代码来源:merkleblock.cpp


注:本文中的CBlock::GetBlockHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。