mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Add debug log when gossip block recieved (#1026)
* Add debug! log for processing gossip block * Fix stray dbg! command
This commit is contained in:
@@ -1445,7 +1445,34 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&self,
|
||||
block: SignedBeaconBlock<T::EthSpec>,
|
||||
) -> Result<GossipVerifiedBlock<T>, BlockError> {
|
||||
GossipVerifiedBlock::new(block, self)
|
||||
let slot = block.message.slot;
|
||||
let graffiti_string = String::from_utf8(block.message.body.graffiti[..].to_vec())
|
||||
.unwrap_or_else(|_| format!("{:?}", &block.message.body.graffiti[..]));
|
||||
|
||||
match GossipVerifiedBlock::new(block, self) {
|
||||
Ok(verified) => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Successfully processed gossip block";
|
||||
"graffiti" => graffiti_string,
|
||||
"slot" => slot,
|
||||
"root" => format!("{:?}", verified.block_root()),
|
||||
);
|
||||
|
||||
Ok(verified)
|
||||
}
|
||||
Err(e) => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Rejected gossip block";
|
||||
"error" => format!("{:?}", e),
|
||||
"graffiti" => graffiti_string,
|
||||
"slot" => slot,
|
||||
);
|
||||
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `Ok(block_root)` if the given `unverified_block` was successfully verified and
|
||||
|
||||
@@ -304,6 +304,10 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
|
||||
Err(BlockError::ProposalSignatureInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn block_root(&self) -> Hash256 {
|
||||
self.block_root
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> IntoFullyVerifiedBlock<T> for GossipVerifiedBlock<T> {
|
||||
|
||||
Reference in New Issue
Block a user