Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/compactproofs.h
// Copyright (c) 2022 The Bitcoin developers | // Copyright (c) 2022 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_COMPACTPROOFS_H | #ifndef BITCOIN_AVALANCHE_COMPACTPROOFS_H | ||||
#define BITCOIN_AVALANCHE_COMPACTPROOFS_H | #define BITCOIN_AVALANCHE_COMPACTPROOFS_H | ||||
#include <avalanche/peermanager.h> | #include <avalanche/prooftreeelement.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <ios> | #include <ios> | ||||
#include <limits> | #include <limits> | ||||
#include <utility> | #include <utility> | ||||
Show All 13 Lines | private: | ||||
std::vector<uint64_t> shortproofids; | std::vector<uint64_t> shortproofids; | ||||
public: | public: | ||||
static constexpr int SHORTPROOFIDS_LENGTH = 6; | static constexpr int SHORTPROOFIDS_LENGTH = 6; | ||||
CompactProofs() | CompactProofs() | ||||
: shortproofidk0(GetRand(std::numeric_limits<uint64_t>::max())), | : shortproofidk0(GetRand(std::numeric_limits<uint64_t>::max())), | ||||
shortproofidk1(GetRand(std::numeric_limits<uint64_t>::max())) {} | shortproofidk1(GetRand(std::numeric_limits<uint64_t>::max())) {} | ||||
CompactProofs(const RadixTree<PeerManager::ProofElement> &proofs); | CompactProofs(const RadixTree<ProofTreeElement> &proofs); | ||||
uint64_t getShortID(const ProofId &proofid) const; | uint64_t getShortID(const ProofId &proofid) const; | ||||
size_t size() const { return shortproofids.size(); } | size_t size() const { return shortproofids.size(); } | ||||
std::pair<uint64_t, uint64_t> getKeys() const { | std::pair<uint64_t, uint64_t> getKeys() const { | ||||
return std::make_pair(shortproofidk0, shortproofidk1); | return std::make_pair(shortproofidk0, shortproofidk1); | ||||
} | } | ||||
Show All 20 Lines |