Kagome
Polkadot Runtime Engine in C++17
babe_block_header.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_BABE_BLOCK_HEADER_HPP
7 #define KAGOME_BABE_BLOCK_HEADER_HPP
8 
11 #include "crypto/sr25519_types.hpp"
12 #include "primitives/authority.hpp"
13 #include "primitives/common.hpp"
14 
15 #include <scale/scale.hpp>
16 
17 namespace kagome::consensus {
24  struct BabeBlockHeader {
26 
29 
32 
35 
36  SlotType slotType() const {
37  return slot_assignment_type;
38  }
39 
40  bool needVRFCheck() const {
43  }
44 
47  }
48 
52  }
53 
60  friend inline ::scale::ScaleEncoderStream &operator<<(
61  ::scale::ScaleEncoderStream &s, const BabeBlockHeader &bh) {
63  if (bh.needVRFCheck()) {
64  s << bh.vrf_output;
65  }
66  return s;
67  }
68 
75  friend inline ::scale::ScaleDecoderStream &operator>>(
76  ::scale::ScaleDecoderStream &s, BabeBlockHeader &bh) {
78  if (bh.needVRFCheck()) {
79  s >> bh.vrf_output;
80  }
81  return s;
82  }
83  };
84 } // namespace kagome::consensus
85 
86 #endif // KAGOME_BABE_BLOCK_HEADER_HPP
uint32_t AuthorityIndex
Definition: authority.hpp:36
A secondary deterministic slot assignment.
A secondary deterministic slot assignment with VRF outputs.
crypto::VRFOutput vrf_output
output of VRF function
BabeSlotNumber slot_number
slot, in which the block was produced
friend::scale::ScaleEncoderStream & operator<<(::scale::ScaleEncoderStream &s, const BabeBlockHeader &bh)
outputs object of type BabeBlockHeader to stream
friend::scale::ScaleDecoderStream & operator>>(::scale::ScaleDecoderStream &s, BabeBlockHeader &bh)
decodes object of type BabeBlockHeader from stream
uint64_t BabeSlotNumber
slot number of the Babe production
Definition: common.hpp:24
primitives::AuthorityIndex authority_index
authority index of the producer
A primary VRF-based slot assignment.