consensus: Move proposal task into consensus/task.

This commit is contained in:
parazyd
2022-04-21 15:43:49 +02:00
parent 101754353f
commit 97dadd8bf0
2 changed files with 7 additions and 3 deletions

View File

@@ -3,3 +3,6 @@ pub use block_sync::block_sync_task;
mod fork_sync;
pub use fork_sync::fork_sync_task;
mod proposal;
pub use proposal::proposal_task;

View File

@@ -1,12 +1,13 @@
use log::{debug, error, info};
use darkfi::{
use crate::{
consensus2::{state::ValidatorStatePtr, Participant},
net::P2pPtr,
net,
util::async_util::sleep,
};
pub async fn proposal_task(p2p: P2pPtr, state: ValidatorStatePtr) {
/// async task used for participating in the consensus protocol
pub async fn proposal_task(p2p: net::P2pPtr, state: ValidatorStatePtr) {
// Node signals the network that it starts participating
let participant = Participant::new(state.read().await.id, state.read().await.current_epoch());
state.write().await.append_participant(participant.clone());