Kagome
Polkadot Runtime Engine in C++17
status.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_NETWORK_TYPES_STATUS_HPP
7 #define KAGOME_CORE_NETWORK_TYPES_STATUS_HPP
8 
9 #include <algorithm>
10 #include <libp2p/peer/peer_info.hpp>
11 #include <vector>
12 
13 #include "network/types/roles.hpp"
14 #include "primitives/common.hpp"
15 
16 namespace kagome::network {
17 
20 
26  struct Status {
31 
36 
41  };
42 
50  template <class Stream,
51  typename = std::enable_if_t<Stream::is_encoder_stream>>
52  Stream &operator<<(Stream &s, const Status &v) {
53  return s << v.roles << v.best_block.number << v.best_block.hash
54  << v.genesis_hash;
55  }
56 
64  template <class Stream,
65  typename = std::enable_if_t<Stream::is_decoder_stream>>
67  return s >> v.roles >> v.best_block.number >> v.best_block.hash
68  >> v.genesis_hash;
69  }
70 
71 } // namespace kagome::network
72 
73 #endif // KAGOME_CORE_NETWORK_TYPES_STATUS_HPP
Stream & operator>>(Stream &s, BlockAttributes &attributes)
primitives::BlockInfo best_block
Definition: status.hpp:35
BlockHash genesis_hash
Definition: status.hpp:40
Stream & operator<<(Stream &s, const BlockAttributes &v)
outputs object of type BlockAttributes to stream
common::Hash256 BlockHash
Definition: block_id.hpp:15
libp2p::connection::Stream Stream
primitives::BlockHash BlockHash
Definition: common.hpp:23
detail::BlockInfoT< struct BlockInfoTag > BlockInfo
Definition: common.hpp:63