| 29 | } |
| 30 | |
| 31 | void 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 | |
| 42 | uint64_t CBlockHeaderAndShortTxIDs::GetShortID(const uint256& txhash) const { |
| 43 | static_assert(SHORTTXIDS_LENGTH == 6, "shorttxids calculation assumes 6-byte shorttxids"); |