mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Merge branch 'master' into attestation-processing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes};
|
||||
use eth2_libp2p::PubsubMessage;
|
||||
use eth2_libp2p::TopicBuilder;
|
||||
use eth2_libp2p::Topic;
|
||||
use eth2_libp2p::BEACON_ATTESTATION_TOPIC;
|
||||
use futures::Future;
|
||||
use grpcio::{RpcContext, RpcStatus, RpcStatusCode, UnarySink};
|
||||
@@ -11,7 +11,7 @@ use protos::services::{
|
||||
};
|
||||
use protos::services_grpc::AttestationService;
|
||||
use slog::{error, info, trace, warn};
|
||||
use ssz::{ssz_encode, Decode};
|
||||
use ssz::{ssz_encode, Decode, Encode};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
use types::Attestation;
|
||||
@@ -19,7 +19,7 @@ use types::Attestation;
|
||||
#[derive(Clone)]
|
||||
pub struct AttestationServiceInstance<T: BeaconChainTypes> {
|
||||
pub chain: Arc<BeaconChain<T>>,
|
||||
pub network_chan: mpsc::UnboundedSender<NetworkMessage<T::EthSpec>>,
|
||||
pub network_chan: mpsc::UnboundedSender<NetworkMessage>,
|
||||
pub log: slog::Logger,
|
||||
}
|
||||
|
||||
@@ -144,13 +144,13 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
|
||||
);
|
||||
|
||||
// valid attestation, propagate to the network
|
||||
let topic = TopicBuilder::new(BEACON_ATTESTATION_TOPIC).build();
|
||||
let message = PubsubMessage::Attestation(attestation);
|
||||
let topic = Topic::new(BEACON_ATTESTATION_TOPIC.into());
|
||||
let message = PubsubMessage::Attestation(attestation.as_ssz_bytes());
|
||||
|
||||
self.network_chan
|
||||
.try_send(NetworkMessage::Publish {
|
||||
topics: vec![topic],
|
||||
message: Box::new(message),
|
||||
message: message,
|
||||
})
|
||||
.unwrap_or_else(|e| {
|
||||
error!(
|
||||
|
||||
Reference in New Issue
Block a user