5#ifndef BITCOIN_AVALANCHE_COMPACTPROOFS_H
6#define BITCOIN_AVALANCHE_COMPACTPROOFS_H
25 struct TestCompactProofs;
46 return lhs->getId() == rhs->getId();
73 std::pair<uint64_t, uint64_t>
getKeys()
const {
83 obj.shortproofidk0, obj.shortproofidk1,
87 obj.prefilledProofs));
89 if (ser_action.ForRead() && obj.prefilledProofs.size() > 0) {
93 uint64_t highestPrefilledIndex = obj.prefilledProofs.back().index;
96 if (highestPrefilledIndex + obj.shortproofids.size() >
97 std::numeric_limits<uint32_t>::max()) {
98 throw std::ios_base::failure(
"indexes overflowed 32 bits");
104 if (highestPrefilledIndex >= obj.size()) {
105 throw std::ios_base::failure(
"non contiguous indexes");
111 friend struct ::avalanche::TestCompactProofs;
SERIALIZE_METHODS(CompactProofs, obj)
std::vector< PrefilledProof > prefilledProofs
const std::vector< PrefilledProof > & getPrefilledProofs() const
uint64_t getShortID(const ProofId &proofid) const
std::pair< uint64_t, uint64_t > getKeys() const
const std::vector< uint64_t > & getShortIDs() const
std::vector< uint64_t > shortproofids
static constexpr int SHORTPROOFIDS_LENGTH
std::vector< uint32_t > indices
SERIALIZE_METHODS(ProofsRequest, obj)
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...
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class.
void UnserData(Stream &s)
avalanche::ProofRef proof
bool operator()(const ProofRef &lhs, const ProofRef &rhs) const
ProofRef getItem(const PrefilledProof &pp) const
uint32_t getIndex(const PrefilledProof &pp) const