Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/compactproofs.h
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public: | ||||
uint64_t getShortID(const ProofId &proofid) const; | uint64_t getShortID(const ProofId &proofid) const; | ||||
size_t size() const { | size_t size() const { | ||||
return shortproofids.size() + prefilledProofs.size(); | return shortproofids.size() + prefilledProofs.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); | ||||
} | } | ||||
const std::vector<PrefilledProof> &getPrefilledProofs() const { | |||||
return prefilledProofs; | |||||
} | |||||
const std::vector<uint64_t> &getShortIDs() const { return shortproofids; } | |||||
SERIALIZE_METHODS(CompactProofs, obj) { | SERIALIZE_METHODS(CompactProofs, obj) { | ||||
READWRITE( | READWRITE( | ||||
obj.shortproofidk0, obj.shortproofidk1, | obj.shortproofidk0, obj.shortproofidk1, | ||||
Using<VectorFormatter<CustomUintFormatter<SHORTPROOFIDS_LENGTH>>>( | Using<VectorFormatter<CustomUintFormatter<SHORTPROOFIDS_LENGTH>>>( | ||||
obj.shortproofids), | obj.shortproofids), | ||||
Using<VectorFormatter<PrefilledProof::Formatter>>( | Using<VectorFormatter<PrefilledProof::Formatter>>( | ||||
obj.prefilledProofs)); | obj.prefilledProofs)); | ||||
} | } | ||||
private: | private: | ||||
friend struct ::avalanche::TestCompactProofs; | friend struct ::avalanche::TestCompactProofs; | ||||
}; | }; | ||||
class ProofsRequest { | |||||
public: | |||||
std::vector<uint32_t> indices; | |||||
SERIALIZE_METHODS(ProofsRequest, obj) { | |||||
READWRITE(Using<VectorFormatter<DifferenceFormatter>>(obj.indices)); | |||||
} | |||||
}; | |||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_COMPACTPROOFS_H | #endif // BITCOIN_AVALANCHE_COMPACTPROOFS_H |