Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
compactproofs.cpp
Go to the documentation of this file.
1// Copyright (c) 2022 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
6
7#include <avalanche/proofid.h>
8#include <crypto/siphash.h>
9
10namespace avalanche {
11
14 : CompactProofs() {
15 proofs.forEachLeaf([&](auto pLeaf) {
16 shortproofids.push_back(getShortID(pLeaf->getId()));
17 return true;
18 });
19}
20
22 static_assert(SHORTPROOFIDS_LENGTH == 6,
23 "shortproofids calculation assumes 6-byte shortproofids");
25 0xffffffffffffL;
26}
27
28} // namespace avalanche
uint64_t getShortID(const ProofId &proofid) const
std::vector< uint64_t > shortproofids
static constexpr int SHORTPROOFIDS_LENGTH
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256 &val)
Optimized SipHash-2-4 implementation for uint256.
Definition siphash.cpp:99
This is a radix tree storing values identified by a unique key.
Definition radix.h:40