mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Network sync refactoring (part 7) (#12006)
* Move `MultiaddrWithPeerId` and related parsing functions into `sc-network-common`, remove dependency on `sc-network` from `sc-chain-spec` * Remove dependency on `sc-network` from `sc-offchain` * Remove dependency on `sc-network` from `sc-network-gossip`
This commit is contained in:
@@ -21,8 +21,8 @@ use crate::{
|
||||
Network, Validator,
|
||||
};
|
||||
|
||||
use sc_network::ReputationChange;
|
||||
use sc_network_common::protocol::event::Event;
|
||||
use sc_peerset::ReputationChange;
|
||||
|
||||
use futures::{
|
||||
channel::mpsc::{channel, Receiver, Sender},
|
||||
@@ -152,7 +152,7 @@ impl<B: BlockT> GossipEngine<B> {
|
||||
|
||||
/// Send addressed message to the given peers. The message is not kept or multicast
|
||||
/// later on.
|
||||
pub fn send_message(&mut self, who: Vec<sc_network::PeerId>, data: Vec<u8>) {
|
||||
pub fn send_message(&mut self, who: Vec<PeerId>, data: Vec<u8>) {
|
||||
for who in &who {
|
||||
self.state_machine.send_message(&mut *self.network, who, data.clone());
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ pub use self::{
|
||||
validator::{DiscardAll, MessageIntent, ValidationResult, Validator, ValidatorContext},
|
||||
};
|
||||
|
||||
use sc_network::{multiaddr, PeerId};
|
||||
use libp2p::{multiaddr, PeerId};
|
||||
use sc_network_common::service::{
|
||||
NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
|
||||
};
|
||||
|
||||
@@ -42,9 +42,9 @@ const REBROADCAST_INTERVAL: time::Duration = time::Duration::from_millis(750);
|
||||
pub(crate) const PERIODIC_MAINTENANCE_INTERVAL: time::Duration = time::Duration::from_millis(1100);
|
||||
|
||||
mod rep {
|
||||
use sc_network::ReputationChange as Rep;
|
||||
use sc_peerset::ReputationChange as Rep;
|
||||
/// Reputation change when a peer sends us a gossip message that we didn't know about.
|
||||
pub const GOSSIP_SUCCESS: Rep = Rep::new(1 << 4, "Successfull gossip");
|
||||
pub const GOSSIP_SUCCESS: Rep = Rep::new(1 << 4, "Successful gossip");
|
||||
/// Reputation change when a peer sends us a gossip message that we already knew about.
|
||||
pub const DUPLICATE_GOSSIP: Rep = Rep::new(-(1 << 2), "Duplicate gossip");
|
||||
}
|
||||
@@ -513,7 +513,6 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::multiaddr::Multiaddr;
|
||||
use futures::prelude::*;
|
||||
use sc_network::ReputationChange;
|
||||
use sc_network_common::{
|
||||
protocol::event::Event,
|
||||
service::{
|
||||
@@ -521,6 +520,7 @@ mod tests {
|
||||
NotificationSender, NotificationSenderError,
|
||||
},
|
||||
};
|
||||
use sc_peerset::ReputationChange;
|
||||
use sp_runtime::{
|
||||
testing::{Block as RawBlock, ExtrinsicWrapper, H256},
|
||||
traits::NumberFor,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use sc_network::PeerId;
|
||||
use libp2p::PeerId;
|
||||
use sc_network_common::protocol::event::ObservedRole;
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user