Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
enum struct VoteStatus : uint8_t { | enum struct VoteStatus : uint8_t { | ||||
Invalid, | Invalid, | ||||
Rejected, | Rejected, | ||||
Accepted, | Accepted, | ||||
Finalized, | Finalized, | ||||
}; | }; | ||||
template <typename VoteItem> class VoteItemUpdate { | template <typename VoteItem> class VoteItemUpdate { | ||||
std::remove_reference_t<VoteItem> item; | VoteItem item; | ||||
VoteStatus status; | VoteStatus status; | ||||
public: | public: | ||||
VoteItemUpdate(const VoteItem itemIn, VoteStatus statusIn) | VoteItemUpdate(const VoteItem itemIn, VoteStatus statusIn) | ||||
: item(itemIn), status(statusIn) {} | : item(std::move(itemIn)), status(statusIn) {} | ||||
const VoteStatus &getStatus() const { return status; } | const VoteStatus &getStatus() const { return status; } | ||||
VoteItem getVoteItem() { return item; } | VoteItem getVoteItem() { return item; } | ||||
const VoteItem getVoteItem() const { return item; } | const VoteItem getVoteItem() const { return item; } | ||||
}; | }; | ||||
using BlockUpdate = VoteItemUpdate<CBlockIndex *>; | using BlockUpdate = VoteItemUpdate<CBlockIndex *>; | ||||
using ProofUpdate = VoteItemUpdate<std::shared_ptr<Proof> &>; | using ProofUpdate = VoteItemUpdate<std::shared_ptr<Proof>>; | ||||
using BlockVoteMap = | using BlockVoteMap = | ||||
std::map<const CBlockIndex *, VoteRecord, CBlockIndexWorkComparator>; | std::map<const CBlockIndex *, VoteRecord, CBlockIndexWorkComparator>; | ||||
using ProofVoteMap = std::map<const std::shared_ptr<Proof>, VoteRecord, | using ProofVoteMap = std::map<const std::shared_ptr<Proof>, VoteRecord, | ||||
ProofSharedPointerComparator>; | ProofSharedPointerComparator>; | ||||
struct query_timeout {}; | struct query_timeout {}; | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |