mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 04:13:00 +00:00
notes from call
This commit is contained in:
@@ -204,7 +204,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||
let should_forward_on = self
|
||||
.message_processor
|
||||
.on_block_gossip(peer_id.clone(), block);
|
||||
// TODO: Apply more sophisticated validation and decoding logic
|
||||
// TODO: Apply more sophisticated validation and decoding logic - 524 verify block
|
||||
if should_forward_on {
|
||||
self.propagate_message(id, peer_id.clone());
|
||||
}
|
||||
@@ -215,7 +215,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||
},
|
||||
PubsubMessage::Attestation(message) => match self.decode_gossip_attestation(message) {
|
||||
Ok(attestation) => {
|
||||
// TODO: Apply more sophisticated validation and decoding logic
|
||||
// TODO: Apply more sophisticated validation and decoding logic - 524 verify attestation
|
||||
self.propagate_message(id, peer_id.clone());
|
||||
self.message_processor
|
||||
.on_attestation_gossip(peer_id, attestation);
|
||||
@@ -297,7 +297,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||
&self,
|
||||
beacon_block: Vec<u8>,
|
||||
) -> Result<BeaconBlock<T::EthSpec>, DecodeError> {
|
||||
//TODO: Apply verification before decoding.
|
||||
//TODO: Apply verification before decoding. - 524
|
||||
BeaconBlock::from_ssz_bytes(&beacon_block)
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||
&self,
|
||||
beacon_block: Vec<u8>,
|
||||
) -> Result<Attestation<T::EthSpec>, DecodeError> {
|
||||
//TODO: Apply verification before decoding.
|
||||
//TODO: Apply verification before decoding. - 524
|
||||
Attestation::from_ssz_bytes(&beacon_block)
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,16 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
|
||||
///
|
||||
/// Attempts to apply to block to the beacon chain. May queue the block for later processing.
|
||||
///
|
||||
/// Returns a `bool` which, if `true`, indicates we should forward the block to our peers.
|
||||
/// Returns a `bool` which, if `true`, indicates we should forward the block to our peers. 524
|
||||
/// Old blocks or blocks on a different fork. Will need to recalc proposer shuffle.
|
||||
/// May need heuristics...
|
||||
/// Cases:
|
||||
/// Do we know the block's parent?
|
||||
/// 1.) It's a recent block on the same chain. We can use the current cache in the BeaconChain. (cheap)
|
||||
/// 2.) Old block on a different fork. (may have to recalc shuffling)
|
||||
/// If we don't know the block's parent, we don't who is supposed to sign it, therefore we can
|
||||
/// not validate the signature.
|
||||
/// 1.) We can try to look up the block's parent using the syncing thread. (it's expensive not sure how to reprop from sync thread)
|
||||
pub fn on_block_gossip(&mut self, peer_id: PeerId, block: BeaconBlock<T::EthSpec>) -> bool {
|
||||
match self.chain.process_block(block.clone()) {
|
||||
Ok(outcome) => match outcome {
|
||||
|
||||
Reference in New Issue
Block a user