From 111c81f42836f215a4e6190cd95f139c83328b8c Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 1 Apr 2019 15:23:38 +1100 Subject: [PATCH] Add ParentUnknown block processing to `SimpleSync` --- beacon_node/network/src/sync/simple_sync.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/beacon_node/network/src/sync/simple_sync.rs b/beacon_node/network/src/sync/simple_sync.rs index 6a78dc57d..e7ef301bb 100644 --- a/beacon_node/network/src/sync/simple_sync.rs +++ b/beacon_node/network/src/sync/simple_sync.rs @@ -582,7 +582,23 @@ impl SimpleSync { ); match self.chain.process_block(block.clone()) { Ok(BlockProcessingOutcome::InvalidBlock(InvalidBlock::ParentUnknown)) => { - // get the parent. + // The block was valid and we processed it successfully. + debug!( + self.log, "NewGossipBlock"; + "msg" => "parent block unknown", + "parent_root" => format!("{}", block.previous_block_root), + "peer" => format!("{:?}", peer_id), + ); + // Send a hello to learn of the clients best slot so we can then sync the require + // parent(s). + network.send_rpc_request( + peer_id.clone(), + RPCRequest::Hello(self.chain.hello_message()), + ); + // Forward the block onto our peers. + // + // Note: this may need to be changed if we decide to only forward blocks if we have + // all required info. true } Ok(BlockProcessingOutcome::InvalidBlock(InvalidBlock::FutureSlot {