Propogate valid attestations accross the network
This commit is contained in:
parent
9c6af0397d
commit
95ce8ca6e6
@ -136,11 +136,10 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
|
|||||||
"type" => "valid_attestation",
|
"type" => "valid_attestation",
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Obtain topics from the network service properly.
|
// valid attestation, propagate to the network
|
||||||
let topic = types::TopicBuilder::new("beacon_chain".to_string()).build();
|
let topic = types::TopicBuilder::new("attestations".to_string()).build();
|
||||||
let message = PubsubMessage::Attestation(attestation);
|
let message = PubsubMessage::Attestation(attestation);
|
||||||
|
|
||||||
// Publish the attestation to the p2p network via gossipsub.
|
|
||||||
self.network_chan
|
self.network_chan
|
||||||
.send(NetworkMessage::Publish {
|
.send(NetworkMessage::Publish {
|
||||||
topics: vec![topic],
|
topics: vec![topic],
|
||||||
@ -150,7 +149,7 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
|
|||||||
error!(
|
error!(
|
||||||
self.log,
|
self.log,
|
||||||
"PublishAttestation";
|
"PublishAttestation";
|
||||||
"type" => "failed to publish to gossipsub",
|
"type" => "failed to publish attestation to gossipsub",
|
||||||
"error" => format!("{:?}", e)
|
"error" => format!("{:?}", e)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -60,6 +60,7 @@ pub fn start_server<T: BeaconChainTypes + Clone + 'static>(
|
|||||||
};
|
};
|
||||||
let attestation_service = {
|
let attestation_service = {
|
||||||
let instance = AttestationServiceInstance {
|
let instance = AttestationServiceInstance {
|
||||||
|
network_chan,
|
||||||
chain: beacon_chain.clone(),
|
chain: beacon_chain.clone(),
|
||||||
network_chan,
|
network_chan,
|
||||||
log: log.clone(),
|
log: log.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user