cfxcore/pos/consensus/util/
config_subscription.rs

1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use channel::diem_channel::Receiver;
9use diem_types::on_chain_config::{
10    new_epoch_event_key, OnChainConfigPayload, ON_CHAIN_CONFIG_REGISTRY,
11};
12use subscription_service::ReconfigSubscription;
13
14/// Creates consensus's subscription to reconfiguration notification from state
15/// sync
16pub fn gen_consensus_reconfig_subscription(
17) -> (ReconfigSubscription, Receiver<(), OnChainConfigPayload>) {
18    ReconfigSubscription::subscribe_all(
19        "consensus",
20        ON_CHAIN_CONFIG_REGISTRY.to_vec(),
21        vec![new_epoch_event_key()],
22    )
23}