Exemple #1
0
CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block) :
        nonce(GetRand(std::numeric_limits<uint64_t>::max())),
        shorttxids(block.vtx.size() - 1), prefilledtxn(1), header(block) {
    FillShortTxIDSelector();
    //TODO: Use our mempool prior to block acceptance to predictively fill more than just the coinbase
    prefilledtxn[0] = {0, block.vtx[0]};
    for (size_t i = 1; i < block.vtx.size(); i++) {
        const CTransaction& tx = block.vtx[i];
        shorttxids[i - 1] = GetShortID(tx.GetHash());
    }
}
CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block)
    : nonce(GetRand(std::numeric_limits<uint64_t>::max()))
    , shorttxids(block.vtx.size() - 1)
    , prefilledtxn(1)
    , header(block)
{
    FillShortTxIDSelector();

    prefilledtxn[0] = { 0, block.vtx[0] };
    for (size_t i = 1; i < block.vtx.size(); i++) {
        const CTransaction& tx = block.vtx[i];
        shorttxids[i - 1] = GetShortID(tx.GetHash());
    }
}