MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CBlockHeaderAndShortTxIDs

Method CBlockHeaderAndShortTxIDs

src/blockencodings.cpp:18–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include <unordered_map>
17
18CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block, bool fUseWTXID) :
19 nonce(GetRand(std::numeric_limits<uint64_t>::max())),
20 shorttxids(block.vtx.size() - 1), prefilledtxn(1), header(block) {
21 FillShortTxIDSelector();
22 //TODO: Use our mempool prior to block acceptance to predictively fill more than just the coinbase
23 prefilledtxn[0] = {0, block.vtx[0]};
24 for (size_t i = 1; i < block.vtx.size(); i++) {
25 const CTransaction& tx = *block.vtx[i];
26 shorttxids[i - 1] = GetShortID(fUseWTXID ? tx.GetWitnessHash() : tx.GetHash());
27 }
28}
29
30void CBlockHeaderAndShortTxIDs::FillShortTxIDSelector() const {
31 CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);

Callers

nothing calls this directly

Calls 4

GetRandFunction · 0.85
maxFunction · 0.85
sizeMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected