mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
Change P2P protocol version
This commit is contained in:
parent
0f93b035f1
commit
43afc79a4a
@ -93,7 +93,10 @@ pub use peer_manager::{
|
|||||||
};
|
};
|
||||||
pub use service::{load_private_key, Context, Libp2pEvent, Service, NETWORK_KEY_FILENAME};
|
pub use service::{load_private_key, Context, Libp2pEvent, Service, NETWORK_KEY_FILENAME};
|
||||||
|
|
||||||
pub const PROTOCOL_VERSION: [u8; 3] = [0, 1, 0];
|
/// Defines the current P2P protocol version.
|
||||||
|
/// - v1: Broadcast FindFile & AnnounceFile messages in the whole network, which caused network too heavey.
|
||||||
|
/// - v2: Publish NewFile to neighbors only and announce file via RPC message.
|
||||||
|
pub const PROTOCOL_VERSION: [u8; 3] = [0, 2, 0];
|
||||||
|
|
||||||
/// Application level requests sent to the network.
|
/// Application level requests sent to the network.
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
@ -397,6 +397,9 @@ impl Libp2pEventHandler {
|
|||||||
Err(_) => return MessageAcceptance::Reject,
|
Err(_) => return MessageAcceptance::Reject,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// update shard config cache
|
||||||
|
self.file_location_cache.insert_peer_config(from, announced_shard_config);
|
||||||
|
|
||||||
// ignore if already exists
|
// ignore if already exists
|
||||||
match self.store.check_tx_completed(msg.tx_id.seq).await {
|
match self.store.check_tx_completed(msg.tx_id.seq).await {
|
||||||
Ok(true) => return MessageAcceptance::Ignore,
|
Ok(true) => return MessageAcceptance::Ignore,
|
||||||
@ -423,9 +426,6 @@ impl Libp2pEventHandler {
|
|||||||
self.send_to_sync(SyncMessage::NewFile { from, msg });
|
self.send_to_sync(SyncMessage::NewFile { from, msg });
|
||||||
}
|
}
|
||||||
|
|
||||||
self.file_location_cache
|
|
||||||
.insert_peer_config(from, announced_shard_config);
|
|
||||||
|
|
||||||
MessageAcceptance::Ignore
|
MessageAcceptance::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user