use anyhow::Result;
use async_trait::async_trait;
use cfx_types::H256;
use serde::{Deserialize, Serialize};
#[async_trait]
pub trait PowInterface: Send + Sync {
async fn next_pivot_decision(
&self, parent_decision: H256,
) -> Option<(u64, H256)>;
fn validate_proposal_pivot_decision(
&self, parent_decision: H256, me_decision: H256,
) -> bool;
fn get_staking_events(
&self, parent_height: u64, me_height: u64, parent_decision: H256,
me_decision: H256,
) -> Result<Vec<StakingEvent>>;
async fn wait_for_initialization(&self, last_decision: H256);
fn is_normal_phase(&self) -> bool;
}
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum StakingEvent {
Register(H256, Vec<u8>, Vec<u8>),
IncreaseStake(H256, u64),
Retire(H256, u64),
}
pub struct FakePowHandler {}
#[async_trait]
impl PowInterface for FakePowHandler {
async fn next_pivot_decision(
&self, _parent_decision: H256,
) -> Option<(u64, H256)> {
todo!()
}
fn validate_proposal_pivot_decision(
&self, _parent_decision: H256, _me_decision: H256,
) -> bool {
todo!()
}
fn get_staking_events(
&self, _parent_height: u64, _me_height: u64, _parent_decision: H256,
_me_decision: H256,
) -> Result<Vec<StakingEvent>> {
todo!()
}
async fn wait_for_initialization(&self, _last_decision: H256) { todo!() }
fn is_normal_phase(&self) -> bool { todo!() }
}