6 #ifndef KAGOME_CONSENSUS_GRANDPACONTEXT 7 #define KAGOME_CONSENSUS_GRANDPACONTEXT 12 #include <libp2p/peer/peer_id.hpp> 21 void *
operator new(size_t) =
delete;
22 void *
operator new(size_t,
void *) =
delete;
23 void *
operator new[](size_t) =
delete;
24 void *
operator new[](size_t,
void *) =
delete;
39 std::optional<const libp2p::peer::PeerId>
peer_id{};
40 std::optional<const network::VoteMessage>
vote{};
42 std::optional<const network::FullCommitMessage>
commit{};
43 std::set<primitives::BlockInfo, std::greater<primitives::BlockInfo>>
49 static void set(std::shared_ptr<GrandpaContext> context) {
51 if (opt.has_value()) {
52 throw std::runtime_error(
53 "Attempt to set GrandpaContext in thread, " 54 "which has already have it set");
56 opt.emplace(std::move(context));
59 static std::optional<std::shared_ptr<GrandpaContext>>
get() {
65 static std::optional<std::shared_ptr<GrandpaContext>> &
instance() {
66 static thread_local std::optional<std::shared_ptr<GrandpaContext>> inst;
72 if (not opt.has_value()) {
73 opt.emplace(std::make_shared<GrandpaContext>());
77 static std::shared_ptr<GrandpaContext>
release() {
79 auto ptr = std::move(opt.value());
87 #endif // KAGOME_CONSENSUS_GRANDPACONTEXT std::optional< const libp2p::peer::PeerId > peer_id
size_t checked_signature_counter
std::optional< const network::FullCommitMessage > commit
std::set< primitives::BlockInfo, std::greater< primitives::BlockInfo > > missing_blocks
size_t unknown_voter_counter
static std::shared_ptr< GrandpaContext > release()
std::optional< const network::VoteMessage > vote
size_t invalid_signature_counter
std::optional< const network::CatchUpResponse > catch_up_response
static std::optional< std::shared_ptr< GrandpaContext > > & instance()