From 3e91e6ac46a8a97e34822b96b7697db2afc38400 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 2 Mar 2020 20:59:37 -0800 Subject: [PATCH] identify: make identify delta use a new protobuf message --- identify/README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/identify/README.md b/identify/README.md index 2a4ac1dad..548ccd357 100644 --- a/identify/README.md +++ b/identify/README.md @@ -93,10 +93,7 @@ peer dynamically changes its capabilites at runtime. When a peer adds or removes support for one or more protocols, it may open a stream to each remote peer that it wants to update using `/p2p/id/delta/1.0.0` as the protocol id. When the remote peer accepts the stream, the local peer will -send an `Identify` message with only the `delta` field set. The value of the -`delta` field is a `Delta` message, which will include the protocol ids of added -or removed protocols in the `added_protocols` and `rm_protocols` fields, -respectively. +send an `IdentifyDelta` message listing the added and removed protocols. ## The Identify Message @@ -108,20 +105,9 @@ message Identify { repeated bytes listenAddrs = 2; optional bytes observedAddr = 4; repeated string protocols = 3; - optional Delta delta = 7; -} - -message Delta { - repeated string added_protocols = 1; - repeated string rm_protocols = 2; } ``` -The `delta` field of the `Identify` message is only set when sending partial -updates as part of the [`identify/delta`](#identify-delta) protocol. When the -`delta` field is set, it MUST be the only field present in the `Identify` -message, with all other fields unset. - ### protocolVersion The protocol version identifies the family of protocols used by the peer. @@ -159,3 +145,16 @@ observable source address. ### protocols This is a list of protocols supported by the peer. + +## The Identify Delta Message + +```protobuf +message IdentifyDelta { + repeated string added_protocols = 1; + repeated string rm_protocols = 2; +} +``` + +`added_protocols` and `rm_protocols` MUST not intersect. When processing an +update with intersecting `added_protocols` and `rm_protocols`, the recipient +MUST process the removed protocols after the added protocols.