Updated syncing algorithm

This commit is contained in:
Age Manning
2019-08-25 08:25:54 +10:00
parent 0d56df474a
commit 7ee080db60
8 changed files with 27 additions and 16 deletions

View File

@@ -119,7 +119,7 @@ fn network_service(
},
NetworkMessage::Publish { topics, message } => {
debug!(log, "Sending pubsub message"; "topics" => format!("{:?}",topics));
libp2p_service.lock().swarm.publish(topics, message);
libp2p_service.lock().swarm.publish(&topics, message);
}
},
Ok(Async::NotReady) => break,

View File

@@ -465,9 +465,15 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
pub fn on_block_gossip(&mut self, peer_id: PeerId, block: BeaconBlock<T::EthSpec>) -> bool {
if let Ok(outcome) = self.chain.process_block(block.clone()) {
match outcome {
BlockProcessingOutcome::Processed { .. } => SHOULD_FORWARD_GOSSIP_BLOCK,
BlockProcessingOutcome::Processed { .. } => {
trace!(self.log, "Gossipsub block processed";
"peer_id" => format!("{:?}",peer_id));
SHOULD_FORWARD_GOSSIP_BLOCK
}
BlockProcessingOutcome::ParentUnknown { parent: _ } => {
// Inform the sync manager to find parents for this block
trace!(self.log, "Unknown parent gossip";
"peer_id" => format!("{:?}",peer_id));
self.manager.add_unknown_block(block.clone(), peer_id);
SHOULD_FORWARD_GOSSIP_BLOCK
}