11 const std::shared_ptr<const BabeConfigNode> &ancestor,
13 : block(block), parent(ancestor) {
14 BOOST_ASSERT(ancestor !=
nullptr);
19 std::shared_ptr<const primitives::BabeConfiguration>
config) {
20 auto fake_parent = std::make_shared<BabeConfigNode>();
21 auto node = std::make_shared<BabeConfigNode>(fake_parent,
block);
22 node->epoch = std::numeric_limits<decltype(node->epoch)>::max();
23 node->config = std::move(config);
29 std::optional<EpochNumber> target_epoch_number)
const {
31 std::make_shared<BabeConfigNode>(shared_from_this(), target_block);
32 node->epoch = target_epoch_number.value_or(
epoch);
33 node->epoch_changed = node->epoch !=
epoch;
34 if (not node->epoch_changed) {
39 node->next_config.reset();
std::optional< std::shared_ptr< const primitives::BabeConfiguration > > next_config
std::shared_ptr< const primitives::BabeConfiguration > config
consensus::EpochNumber epoch
const primitives::BlockInfo block
std::shared_ptr< BabeConfigNode > makeDescendant(const primitives::BlockInfo &block, std::optional< EpochNumber > epoch_number=std::nullopt) const
static std::shared_ptr< BabeConfigNode > createAsRoot(primitives::BlockInfo block, std::shared_ptr< const primitives::BabeConfiguration > config)