Propogate valid attestations accross the network

This commit is contained in:
Age Manning 2019-04-03 11:20:13 +11:00
parent 9c6af0397d
commit 95ce8ca6e6
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
2 changed files with 4 additions and 4 deletions

View File

@ -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)
); );
}); });

View File

@ -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(),