Some gossip work

This commit is contained in:
realbigsean
2022-02-20 14:11:10 -07:00
parent ebc0ccd02a
commit 3f1e5cee78
14 changed files with 138 additions and 34 deletions

View File

@@ -236,6 +236,14 @@ impl<T: BeaconChainTypes> Router<T> {
block,
);
}
PubsubMessage::Blob(blob) => {
self.processor.on_tx_blob_gossip(
id,
peer_id,
self.network_globals.client(&peer_id),
blob,
);
}
PubsubMessage::VoluntaryExit(exit) => {
debug!(self.log, "Received a voluntary exit"; "peer_id" => %peer_id);
self.processor.on_voluntary_exit_gossip(id, peer_id, exit);

View File

@@ -5,7 +5,8 @@ use crate::service::{NetworkMessage, RequestId};
use crate::status::status_message;
use crate::sync::manager::RequestId as SyncId;
use crate::sync::SyncMessage;
use beacon_chain::{BeaconChain, BeaconChainTypes};
use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes};
use lighthouse_network::rpc::methods::TxBlobsByRangeRequest;
use lighthouse_network::rpc::*;
use lighthouse_network::{
Client, MessageId, NetworkGlobals, PeerId, PeerRequestId, Request, Response,
@@ -16,8 +17,10 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use store::SyncCommitteeMessage;
use tokio::sync::mpsc;
use lighthouse_network::rpc::methods::TxBlobsByRangeRequest;
use types::{Attestation, AttesterSlashing, BlobWrapper, EthSpec, ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock, SignedContributionAndProof, SignedVoluntaryExit, SubnetId, SyncSubnetId};
use types::{
Attestation, AttesterSlashing, BlobWrapper, EthSpec, ProposerSlashing, SignedAggregateAndProof,
SignedBeaconBlock, SignedContributionAndProof, SignedVoluntaryExit, SubnetId, SyncSubnetId,
};
/// Processes validated messages from the network. It relays necessary data to the syncing thread
/// and processes blocks from the pubsub network.
@@ -291,6 +294,22 @@ impl<T: BeaconChainTypes> Processor<T> {
))
}
pub fn on_tx_blob_gossip(
&mut self,
message_id: MessageId,
peer_id: PeerId,
peer_client: Client,
blob: Box<BlobWrapper<T::EthSpec>>,
) {
self.send_beacon_processor_work(BeaconWorkEvent::gossip_tx_blob_block(
message_id,
peer_id,
peer_client,
blob,
timestamp_now(),
))
}
pub fn on_unaggregated_attestation_gossip(
&mut self,
message_id: MessageId,