Skip to content

Commit

Permalink
Log failures of storing incoming blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Zabaluev committed Feb 14, 2019
1 parent e56b275 commit e8cd77d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/blockchain/process.rs
Expand Up @@ -17,20 +17,24 @@ pub fn process<Chain>(
<Chain::Settings as property::Settings>::Update: Clone,
<Chain::Leader as property::LeaderSelection>::Update: Clone,
{
match bquery {
let res = match bquery {
BlockMsg::NetworkBlock(block) => {
debug!("received block from the network: {:#?}", block);
blockchain.write().unwrap().handle_incoming_block(block);
blockchain.write().unwrap().handle_incoming_block(block)
}
BlockMsg::LeadershipBlock(block) => {
debug!("received block from the leadership: {:#?}", block);
blockchain
let res = blockchain
.write()
.unwrap()
.handle_incoming_block(block.clone());
network_broadcast
.unbounded_send(NetworkBroadcastMsg::Block(block))
.unwrap();
res
}
};
if let Err(e) = res {
error!("error processing an incoming block: {:?}", e);
}
}
5 changes: 4 additions & 1 deletion src/network/grpc/bootstrap.rs
Expand Up @@ -59,7 +59,10 @@ where
stream
.fold(blockchain, |blockchain, block| {
// debug!("received block from the bootstrap node: {:#?}", &block);
blockchain.write().unwrap().handle_incoming_block(block);
let res = blockchain.write().unwrap().handle_incoming_block(block);
if let Err(e) = res {
error!("error processing a bootstrap block: {:?}", e);
}
future::ok(blockchain)
})
.map(|_| ())
Expand Down

0 comments on commit e8cd77d

Please sign in to comment.