MCPcopy Create free account
hub / github.com/ElementsProject/elements / FillShortTxIDSelector

Method FillShortTxIDSelector

src/blockencodings.cpp:31–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void CBlockHeaderAndShortTxIDs::FillShortTxIDSelector() const {
32 CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
33 stream << header << nonce;
34 CSHA256 hasher;
35 hasher.Write((unsigned char*)&(*stream.begin()), stream.end() - stream.begin());
36 uint256 shorttxidhash;
37 hasher.Finalize(shorttxidhash.begin());
38 shorttxidk0 = shorttxidhash.GetUint64(0);
39 shorttxidk1 = shorttxidhash.GetUint64(1);
40}
41
42uint64_t CBlockHeaderAndShortTxIDs::GetShortID(const uint256& txhash) const {
43 static_assert(SHORTTXIDS_LENGTH == 6, "shorttxids calculation assumes 6-byte shorttxids");

Callers 1

SERIALIZE_METHODSMethod · 0.80

Calls 5

GetUint64Method · 0.80
WriteMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected