Merge message validation
This commit is contained in:
commit
8256621230
@ -7,8 +7,8 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.32.0"
|
clap = "2.32.0"
|
||||||
#SigP repository
|
#SigP repository
|
||||||
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "61036890d574f5b46573952b20def2baafd6a6e9" }
|
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "76f7475e4b7063e663ad03c7524cf091f9961968" }
|
||||||
enr = { git = "https://github.com/SigP/rust-libp2p/", rev = "61036890d574f5b46573952b20def2baafd6a6e9", features = ["serde"] }
|
enr = { git = "https://github.com/SigP/rust-libp2p/", rev = "76f7475e4b7063e663ad03c7524cf091f9961968", features = ["serde"] }
|
||||||
types = { path = "../../eth2/types" }
|
types = { path = "../../eth2/types" }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
@ -15,7 +15,7 @@ use libp2p::{
|
|||||||
tokio_io::{AsyncRead, AsyncWrite},
|
tokio_io::{AsyncRead, AsyncWrite},
|
||||||
NetworkBehaviour, PeerId,
|
NetworkBehaviour, PeerId,
|
||||||
};
|
};
|
||||||
use slog::{debug, o, trace};
|
use slog::{debug, o};
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@ -90,13 +90,15 @@ impl<TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess<GossipsubE
|
|||||||
{
|
{
|
||||||
fn inject_event(&mut self, event: GossipsubEvent) {
|
fn inject_event(&mut self, event: GossipsubEvent) {
|
||||||
match event {
|
match event {
|
||||||
GossipsubEvent::Message(gs_msg) => {
|
GossipsubEvent::Message(propagation_source, gs_msg) => {
|
||||||
trace!(self.log, "Received GossipEvent");
|
let id = gs_msg.id();
|
||||||
|
|
||||||
let msg = PubsubMessage::from_topics(&gs_msg.topics, gs_msg.data);
|
let msg = PubsubMessage::from_topics(&gs_msg.topics, gs_msg.data);
|
||||||
|
|
||||||
|
// Note: We are keeping track here of the peer that sent us the message, not the
|
||||||
|
// peer that originally published the message.
|
||||||
self.events.push(BehaviourEvent::GossipMessage {
|
self.events.push(BehaviourEvent::GossipMessage {
|
||||||
source: gs_msg.source,
|
id,
|
||||||
|
source: propagation_source,
|
||||||
topics: gs_msg.topics,
|
topics: gs_msg.topics,
|
||||||
message: msg,
|
message: msg,
|
||||||
});
|
});
|
||||||
@ -199,6 +201,13 @@ impl<TSubstream: AsyncRead + AsyncWrite> Behaviour<TSubstream> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Forwards a message that is waiting in gossipsub's mcache. Messages are only propagated
|
||||||
|
/// once validated by the beacon chain.
|
||||||
|
pub fn propagate_message(&mut self, propagation_source: &PeerId, message_id: String) {
|
||||||
|
self.gossipsub
|
||||||
|
.propagate_message(&message_id, propagation_source);
|
||||||
|
}
|
||||||
|
|
||||||
/* Eth2 RPC behaviour functions */
|
/* Eth2 RPC behaviour functions */
|
||||||
|
|
||||||
/// Sends an RPC Request/Response via the RPC protocol.
|
/// Sends an RPC Request/Response via the RPC protocol.
|
||||||
@ -214,12 +223,21 @@ impl<TSubstream: AsyncRead + AsyncWrite> Behaviour<TSubstream> {
|
|||||||
|
|
||||||
/// The types of events than can be obtained from polling the behaviour.
|
/// The types of events than can be obtained from polling the behaviour.
|
||||||
pub enum BehaviourEvent {
|
pub enum BehaviourEvent {
|
||||||
|
/// A received RPC event and the peer that it was received from.
|
||||||
RPC(PeerId, RPCEvent),
|
RPC(PeerId, RPCEvent),
|
||||||
|
/// We have completed an initial connection to a new peer.
|
||||||
PeerDialed(PeerId),
|
PeerDialed(PeerId),
|
||||||
|
/// A peer has disconnected.
|
||||||
PeerDisconnected(PeerId),
|
PeerDisconnected(PeerId),
|
||||||
|
/// A gossipsub message has been received.
|
||||||
GossipMessage {
|
GossipMessage {
|
||||||
|
/// The gossipsub message id. Used when propagating blocks after validation.
|
||||||
|
id: String,
|
||||||
|
/// The peer from which we received this message, not the peer that published it.
|
||||||
source: PeerId,
|
source: PeerId,
|
||||||
|
/// The topics that this message was sent on.
|
||||||
topics: Vec<TopicHash>,
|
topics: Vec<TopicHash>,
|
||||||
|
/// The message itself.
|
||||||
message: PubsubMessage,
|
message: PubsubMessage,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,8 @@ impl Default for Config {
|
|||||||
// parameter.
|
// parameter.
|
||||||
gs_config: GossipsubConfigBuilder::new()
|
gs_config: GossipsubConfigBuilder::new()
|
||||||
.max_transmit_size(1_048_576)
|
.max_transmit_size(1_048_576)
|
||||||
.heartbeat_interval(Duration::from_secs(20))
|
.heartbeat_interval(Duration::from_secs(20)) // TODO: Reduce for mainnet
|
||||||
|
.propagate_messages(false) // require validation before propagation
|
||||||
.build(),
|
.build(),
|
||||||
boot_nodes: vec![],
|
boot_nodes: vec![],
|
||||||
libp2p_nodes: vec![],
|
libp2p_nodes: vec![],
|
||||||
|
@ -169,6 +169,7 @@ where
|
|||||||
|
|
||||||
fn inject_connected(&mut self, peer_id: PeerId, _endpoint: ConnectedPoint) {
|
fn inject_connected(&mut self, peer_id: PeerId, _endpoint: ConnectedPoint) {
|
||||||
self.connected_peers.insert(peer_id);
|
self.connected_peers.insert(peer_id);
|
||||||
|
// TODO: Drop peers if over max_peer limit
|
||||||
|
|
||||||
metrics::inc_counter(&metrics::PEER_CONNECT_EVENT_COUNT);
|
metrics::inc_counter(&metrics::PEER_CONNECT_EVENT_COUNT);
|
||||||
metrics::set_gauge(&metrics::PEERS_CONNECTED, self.connected_peers() as i64);
|
metrics::set_gauge(&metrics::PEERS_CONNECTED, self.connected_peers() as i64);
|
||||||
|
@ -157,16 +157,16 @@ impl Stream for Service {
|
|||||||
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
|
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
|
||||||
loop {
|
loop {
|
||||||
match self.swarm.poll() {
|
match self.swarm.poll() {
|
||||||
//Behaviour events
|
|
||||||
Ok(Async::Ready(Some(event))) => match event {
|
Ok(Async::Ready(Some(event))) => match event {
|
||||||
// TODO: Stub here for debugging
|
|
||||||
BehaviourEvent::GossipMessage {
|
BehaviourEvent::GossipMessage {
|
||||||
|
id,
|
||||||
source,
|
source,
|
||||||
topics,
|
topics,
|
||||||
message,
|
message,
|
||||||
} => {
|
} => {
|
||||||
trace!(self.log, "Gossipsub message received"; "service" => "Swarm");
|
trace!(self.log, "Gossipsub message received"; "service" => "Swarm");
|
||||||
return Ok(Async::Ready(Some(Libp2pEvent::PubsubMessage {
|
return Ok(Async::Ready(Some(Libp2pEvent::PubsubMessage {
|
||||||
|
id,
|
||||||
source,
|
source,
|
||||||
topics,
|
topics,
|
||||||
message,
|
message,
|
||||||
@ -234,6 +234,7 @@ pub enum Libp2pEvent {
|
|||||||
PeerDisconnected(PeerId),
|
PeerDisconnected(PeerId),
|
||||||
/// Received pubsub message.
|
/// Received pubsub message.
|
||||||
PubsubMessage {
|
PubsubMessage {
|
||||||
|
id: String,
|
||||||
source: PeerId,
|
source: PeerId,
|
||||||
topics: Vec<TopicHash>,
|
topics: Vec<TopicHash>,
|
||||||
message: PubsubMessage,
|
message: PubsubMessage,
|
||||||
|
@ -21,6 +21,8 @@ pub struct MessageHandler<T: BeaconChainTypes> {
|
|||||||
_chain: Arc<BeaconChain<T>>,
|
_chain: Arc<BeaconChain<T>>,
|
||||||
/// The syncing framework.
|
/// The syncing framework.
|
||||||
sync: SimpleSync<T>,
|
sync: SimpleSync<T>,
|
||||||
|
/// A channel to the network service to allow for gossip propagation.
|
||||||
|
network_send: mpsc::UnboundedSender<NetworkMessage>,
|
||||||
/// The `MessageHandler` logger.
|
/// The `MessageHandler` logger.
|
||||||
log: slog::Logger,
|
log: slog::Logger,
|
||||||
}
|
}
|
||||||
@ -34,8 +36,9 @@ pub enum HandlerMessage {
|
|||||||
PeerDisconnected(PeerId),
|
PeerDisconnected(PeerId),
|
||||||
/// An RPC response/request has been received.
|
/// An RPC response/request has been received.
|
||||||
RPC(PeerId, RPCEvent),
|
RPC(PeerId, RPCEvent),
|
||||||
/// A gossip message has been received.
|
/// A gossip message has been received. The fields are: message id, the peer that sent us this
|
||||||
PubsubMessage(PeerId, PubsubMessage),
|
/// message and the message itself.
|
||||||
|
PubsubMessage(String, PeerId, PubsubMessage),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||||
@ -50,12 +53,13 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
|
|
||||||
let (handler_send, handler_recv) = mpsc::unbounded_channel();
|
let (handler_send, handler_recv) = mpsc::unbounded_channel();
|
||||||
// Initialise sync and begin processing in thread
|
// Initialise sync and begin processing in thread
|
||||||
let sync = SimpleSync::new(beacon_chain.clone(), network_send, &log);
|
let sync = SimpleSync::new(beacon_chain.clone(), network_send.clone(), &log);
|
||||||
|
|
||||||
// generate the Message handler
|
// generate the Message handler
|
||||||
let mut handler = MessageHandler {
|
let mut handler = MessageHandler {
|
||||||
_chain: beacon_chain.clone(),
|
_chain: beacon_chain.clone(),
|
||||||
sync,
|
sync,
|
||||||
|
network_send,
|
||||||
log: log.clone(),
|
log: log.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,8 +91,8 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
self.handle_rpc_message(peer_id, rpc_event);
|
self.handle_rpc_message(peer_id, rpc_event);
|
||||||
}
|
}
|
||||||
// An RPC message request/response has been received
|
// An RPC message request/response has been received
|
||||||
HandlerMessage::PubsubMessage(peer_id, gossip) => {
|
HandlerMessage::PubsubMessage(id, peer_id, gossip) => {
|
||||||
self.handle_gossip(peer_id, gossip);
|
self.handle_gossip(id, peer_id, gossip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,24 +198,34 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handle RPC messages
|
/// Handle RPC messages
|
||||||
fn handle_gossip(&mut self, peer_id: PeerId, gossip_message: PubsubMessage) {
|
fn handle_gossip(&mut self, id: String, peer_id: PeerId, gossip_message: PubsubMessage) {
|
||||||
match gossip_message {
|
match gossip_message {
|
||||||
PubsubMessage::Block(message) => match self.decode_gossip_block(message) {
|
PubsubMessage::Block(message) => match self.decode_gossip_block(message) {
|
||||||
Ok(block) => {
|
Ok(block) => {
|
||||||
let _should_forward_on = self.sync.on_block_gossip(peer_id, block);
|
let should_forward_on = self.sync.on_block_gossip(peer_id.clone(), block);
|
||||||
|
// TODO: Apply more sophisticated validation and decoding logic
|
||||||
|
if should_forward_on {
|
||||||
|
self.propagate_message(id, peer_id.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(self.log, "Invalid gossiped beacon block"; "peer_id" => format!("{}", peer_id), "Error" => format!("{:?}", e));
|
debug!(self.log, "Invalid gossiped beacon block"; "peer_id" => format!("{}", peer_id), "Error" => format!("{:?}", e));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PubsubMessage::Attestation(message) => match self.decode_gossip_attestation(message) {
|
PubsubMessage::Attestation(message) => match self.decode_gossip_attestation(message) {
|
||||||
Ok(attestation) => self.sync.on_attestation_gossip(peer_id, attestation),
|
Ok(attestation) => {
|
||||||
|
// TODO: Apply more sophisticated validation and decoding logic
|
||||||
|
self.propagate_message(id, peer_id.clone());
|
||||||
|
self.sync.on_attestation_gossip(peer_id, attestation);
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(self.log, "Invalid gossiped attestation"; "peer_id" => format!("{}", peer_id), "Error" => format!("{:?}", e));
|
debug!(self.log, "Invalid gossiped attestation"; "peer_id" => format!("{}", peer_id), "Error" => format!("{:?}", e));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PubsubMessage::VoluntaryExit(message) => match self.decode_gossip_exit(message) {
|
PubsubMessage::VoluntaryExit(message) => match self.decode_gossip_exit(message) {
|
||||||
Ok(_exit) => {
|
Ok(_exit) => {
|
||||||
|
// TODO: Apply more sophisticated validation and decoding logic
|
||||||
|
self.propagate_message(id, peer_id.clone());
|
||||||
// TODO: Handle exits
|
// TODO: Handle exits
|
||||||
debug!(self.log, "Received a voluntary exit"; "peer_id" => format!("{}", peer_id) );
|
debug!(self.log, "Received a voluntary exit"; "peer_id" => format!("{}", peer_id) );
|
||||||
}
|
}
|
||||||
@ -222,6 +236,8 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
PubsubMessage::ProposerSlashing(message) => {
|
PubsubMessage::ProposerSlashing(message) => {
|
||||||
match self.decode_gossip_proposer_slashing(message) {
|
match self.decode_gossip_proposer_slashing(message) {
|
||||||
Ok(_slashing) => {
|
Ok(_slashing) => {
|
||||||
|
// TODO: Apply more sophisticated validation and decoding logic
|
||||||
|
self.propagate_message(id, peer_id.clone());
|
||||||
// TODO: Handle proposer slashings
|
// TODO: Handle proposer slashings
|
||||||
debug!(self.log, "Received a proposer slashing"; "peer_id" => format!("{}", peer_id) );
|
debug!(self.log, "Received a proposer slashing"; "peer_id" => format!("{}", peer_id) );
|
||||||
}
|
}
|
||||||
@ -233,6 +249,8 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
PubsubMessage::AttesterSlashing(message) => {
|
PubsubMessage::AttesterSlashing(message) => {
|
||||||
match self.decode_gossip_attestation_slashing(message) {
|
match self.decode_gossip_attestation_slashing(message) {
|
||||||
Ok(_slashing) => {
|
Ok(_slashing) => {
|
||||||
|
// TODO: Apply more sophisticated validation and decoding logic
|
||||||
|
self.propagate_message(id, peer_id.clone());
|
||||||
// TODO: Handle attester slashings
|
// TODO: Handle attester slashings
|
||||||
debug!(self.log, "Received an attester slashing"; "peer_id" => format!("{}", peer_id) );
|
debug!(self.log, "Received an attester slashing"; "peer_id" => format!("{}", peer_id) );
|
||||||
}
|
}
|
||||||
@ -248,6 +266,21 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Informs the network service that the message should be forwarded to other peers.
|
||||||
|
fn propagate_message(&mut self, message_id: String, propagation_source: PeerId) {
|
||||||
|
self.network_send
|
||||||
|
.try_send(NetworkMessage::Propagate {
|
||||||
|
propagation_source,
|
||||||
|
message_id,
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|_| {
|
||||||
|
warn!(
|
||||||
|
self.log,
|
||||||
|
"Could not send propagation request to the network service"
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* Decoding of gossipsub objects from the network.
|
/* Decoding of gossipsub objects from the network.
|
||||||
*
|
*
|
||||||
* The decoding is done in the message handler as it has access to to a `BeaconChain` and can
|
* The decoding is done in the message handler as it has access to to a `BeaconChain` and can
|
||||||
|
@ -159,12 +159,23 @@ fn network_service(
|
|||||||
// poll the network channel
|
// poll the network channel
|
||||||
match network_recv.poll() {
|
match network_recv.poll() {
|
||||||
Ok(Async::Ready(Some(message))) => match message {
|
Ok(Async::Ready(Some(message))) => match message {
|
||||||
NetworkMessage::Send(peer_id, outgoing_message) => match outgoing_message {
|
NetworkMessage::RPC(peer_id, rpc_event) => {
|
||||||
OutgoingMessage::RPC(rpc_event) => {
|
|
||||||
trace!(log, "{}", rpc_event);
|
trace!(log, "{}", rpc_event);
|
||||||
libp2p_service.lock().swarm.send_rpc(peer_id, rpc_event);
|
libp2p_service.lock().swarm.send_rpc(peer_id, rpc_event);
|
||||||
}
|
}
|
||||||
},
|
NetworkMessage::Propagate {
|
||||||
|
propagation_source,
|
||||||
|
message_id,
|
||||||
|
} => {
|
||||||
|
trace!(log, "Propagating gossipsub message";
|
||||||
|
"propagation_peer" => format!("{:?}", propagation_source),
|
||||||
|
"message_id" => format!("{}", message_id),
|
||||||
|
);
|
||||||
|
libp2p_service
|
||||||
|
.lock()
|
||||||
|
.swarm
|
||||||
|
.propagate_message(&propagation_source, message_id);
|
||||||
|
}
|
||||||
NetworkMessage::Publish { topics, message } => {
|
NetworkMessage::Publish { topics, message } => {
|
||||||
debug!(log, "Sending pubsub message"; "topics" => format!("{:?}",topics));
|
debug!(log, "Sending pubsub message"; "topics" => format!("{:?}",topics));
|
||||||
libp2p_service.lock().swarm.publish(&topics, message);
|
libp2p_service.lock().swarm.publish(&topics, message);
|
||||||
@ -203,13 +214,14 @@ fn network_service(
|
|||||||
.map_err(|_| "Failed to send PeerDisconnected to handler")?;
|
.map_err(|_| "Failed to send PeerDisconnected to handler")?;
|
||||||
}
|
}
|
||||||
Libp2pEvent::PubsubMessage {
|
Libp2pEvent::PubsubMessage {
|
||||||
source, message, ..
|
id,
|
||||||
|
source,
|
||||||
|
message,
|
||||||
|
..
|
||||||
} => {
|
} => {
|
||||||
//TODO: Decide if we need to propagate the topic upwards. (Potentially for
|
|
||||||
//attestations)
|
|
||||||
message_handler_send
|
message_handler_send
|
||||||
.try_send(HandlerMessage::PubsubMessage(source, message))
|
.try_send(HandlerMessage::PubsubMessage(id, source, message))
|
||||||
.map_err(|_| " failed to send pubsub message to handler")?;
|
.map_err(|_| "Failed to send pubsub message to handler")?;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Ok(Async::Ready(None)) => unreachable!("Stream never ends"),
|
Ok(Async::Ready(None)) => unreachable!("Stream never ends"),
|
||||||
@ -225,19 +237,16 @@ fn network_service(
|
|||||||
/// Types of messages that the network service can receive.
|
/// Types of messages that the network service can receive.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum NetworkMessage {
|
pub enum NetworkMessage {
|
||||||
/// Send a message to libp2p service.
|
/// Send an RPC message to the libp2p service.
|
||||||
//TODO: Define typing for messages across the wire
|
RPC(PeerId, RPCEvent),
|
||||||
Send(PeerId, OutgoingMessage),
|
/// Publish a message to gossipsub.
|
||||||
/// Publish a message to pubsub mechanism.
|
|
||||||
Publish {
|
Publish {
|
||||||
topics: Vec<Topic>,
|
topics: Vec<Topic>,
|
||||||
message: PubsubMessage,
|
message: PubsubMessage,
|
||||||
},
|
},
|
||||||
}
|
/// Propagate a received gossipsub message
|
||||||
|
Propagate {
|
||||||
/// Type of outgoing messages that can be sent through the network service.
|
propagation_source: PeerId,
|
||||||
#[derive(Debug)]
|
message_id: String,
|
||||||
pub enum OutgoingMessage {
|
},
|
||||||
/// Send an RPC request/response.
|
|
||||||
RPC(RPCEvent),
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::manager::{ImportManager, ImportManagerOutcome};
|
use super::manager::{ImportManager, ImportManagerOutcome};
|
||||||
use crate::service::{NetworkMessage, OutgoingMessage};
|
use crate::service::NetworkMessage;
|
||||||
use beacon_chain::{BeaconChain, BeaconChainTypes, BlockProcessingOutcome};
|
use beacon_chain::{BeaconChain, BeaconChainTypes, BlockProcessingOutcome};
|
||||||
use eth2_libp2p::rpc::methods::*;
|
use eth2_libp2p::rpc::methods::*;
|
||||||
use eth2_libp2p::rpc::{RPCEvent, RPCRequest, RPCResponse, RequestId};
|
use eth2_libp2p::rpc::{RPCEvent, RPCRequest, RPCResponse, RequestId};
|
||||||
@ -466,7 +466,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
|
|||||||
SHOULD_FORWARD_GOSSIP_BLOCK
|
SHOULD_FORWARD_GOSSIP_BLOCK
|
||||||
}
|
}
|
||||||
BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_FORWARD_GOSSIP_BLOCK,
|
BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_FORWARD_GOSSIP_BLOCK,
|
||||||
_ => SHOULD_NOT_FORWARD_GOSSIP_BLOCK,
|
_ => SHOULD_NOT_FORWARD_GOSSIP_BLOCK, //TODO: Decide if we want to forward these
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SHOULD_NOT_FORWARD_GOSSIP_BLOCK
|
SHOULD_NOT_FORWARD_GOSSIP_BLOCK
|
||||||
@ -558,12 +558,8 @@ impl NetworkContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn send_rpc_event(&mut self, peer_id: PeerId, rpc_event: RPCEvent) {
|
fn send_rpc_event(&mut self, peer_id: PeerId, rpc_event: RPCEvent) {
|
||||||
self.send(peer_id, OutgoingMessage::RPC(rpc_event))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send(&mut self, peer_id: PeerId, outgoing_message: OutgoingMessage) {
|
|
||||||
self.network_send
|
self.network_send
|
||||||
.try_send(NetworkMessage::Send(peer_id, outgoing_message))
|
.try_send(NetworkMessage::RPC(peer_id, rpc_event))
|
||||||
.unwrap_or_else(|_| {
|
.unwrap_or_else(|_| {
|
||||||
warn!(
|
warn!(
|
||||||
self.log,
|
self.log,
|
||||||
|
Loading…
Reference in New Issue
Block a user