aboutsummaryrefslogtreecommitdiff
path: root/p2p/src/message.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@proton.me>2023-11-22 12:42:00 +0300
committerhozan23 <hozan23@proton.me>2023-11-22 12:49:45 +0300
commit34b0a91dbb107962dae4f593a36d30a29ea87c45 (patch)
treead03f71e8dbb0f8c1884bc2be6ac6368219ce55d /p2p/src/message.rs
parent542897ce2ed7fb8a8627ec8ba8b3490acb29149f (diff)
p2p: Improve error handling during handshake:
Introduce a new entry status, INCOMPATIBLE_ENTRY. Entries with this status will not increase the failure attempts, instead, they will persist in the routing table until replaced by a new peer. This feature is useful for seeding and the lookup process. Add a boolean value to the VerAck message to indicate whether the version is accepted or not.
Diffstat (limited to 'p2p/src/message.rs')
-rw-r--r--p2p/src/message.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/p2p/src/message.rs b/p2p/src/message.rs
index 9e73809..3779cc1 100644
--- a/p2p/src/message.rs
+++ b/p2p/src/message.rs
@@ -62,9 +62,14 @@ pub struct VerMsg {
pub protocols: HashMap<ProtocolID, VersionInt>,
}
-/// VerAck message acknowledging the receipt of a Version message.
+/// VerAck message acknowledges the receipt of a Version message. The message
+/// consists of the peer ID and an acknowledgment boolean value indicating
+/// whether the version is accepted.
#[derive(Decode, Encode, Debug, Clone)]
-pub struct VerAckMsg(pub PeerID);
+pub struct VerAckMsg {
+ pub peer_id: PeerID,
+ pub ack: bool,
+}
/// Shutdown message.
#[derive(Decode, Encode, Debug, Clone)]