Skip to content

Commit

Permalink
[refactor]: Split view changes from normal messages
Browse files Browse the repository at this point in the history
Signed-off-by: Sam H. Smith <[email protected]>
  • Loading branch information
SamHSmith authored and mversic committed Dec 14, 2023
1 parent a2ff9a0 commit 1523d89
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 204 deletions.
8 changes: 3 additions & 5 deletions core/src/block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ impl BlockSynchronizer {
pub mod message {
//! Module containing messages for [`BlockSynchronizer`](super::BlockSynchronizer).
use super::*;
use crate::sumeragi::view_change::ProofChain;

/// Get blocks after some block
#[derive(Debug, Clone, Decode, Encode)]
Expand Down Expand Up @@ -234,11 +233,10 @@ pub mod message {
}
}
Message::ShareBlocks(ShareBlocks { blocks, .. }) => {
use crate::sumeragi::message::{Message, MessagePacket};
use crate::sumeragi::message::{BlockMessage, Message};
for block in blocks.clone() {
block_sync.sumeragi.incoming_message(MessagePacket::new(
ProofChain::default(),
Some(Message::BlockSyncUpdate(block.into())),
block_sync.sumeragi.incoming_message(Message::Block(
BlockMessage::BlockSyncUpdate(block.into()),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tokio::sync::broadcast;

use crate::{
block_sync::message::Message as BlockSyncMessage, prelude::*,
sumeragi::message::MessagePacket as SumeragiPacket,
sumeragi::message::Message as SumeragiPacket,
};

/// The interval at which sumeragi checks if there are tx in the `queue`.
Expand Down
Loading

0 comments on commit 1523d89

Please sign in to comment.