node: Add `until` to `Subscribe` message

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
Alexis Sellier 2022-09-13 13:55:08 +02:00
parent de8dcc5022
commit db176c06b5
No known key found for this signature in database
1 changed files with 18 additions and 4 deletions

View File

@ -337,9 +337,13 @@ pub enum Message {
git: git::Url, git: git::Url,
}, },
/// Subscribe to gossip messages matching the filter, that are newer than the given /// Subscribe to gossip messages matching the filter and time range.
/// timestamp. /// timestamp.
Subscribe { filter: Filter, since: Timestamp }, Subscribe {
filter: Filter,
since: Timestamp,
until: Timestamp,
},
/// Node announcing its inventory to the network. /// Node announcing its inventory to the network.
/// This should be the whole inventory every time. /// This should be the whole inventory every time.
@ -469,9 +473,14 @@ impl wire::Encode for Message {
n += addrs.as_slice().encode(writer)?; n += addrs.as_slice().encode(writer)?;
n += git.encode(writer)?; n += git.encode(writer)?;
} }
Self::Subscribe { filter, since } => { Self::Subscribe {
filter,
since,
until,
} => {
n += filter.encode(writer)?; n += filter.encode(writer)?;
n += since.encode(writer)?; n += since.encode(writer)?;
n += until.encode(writer)?;
} }
Self::RefsAnnouncement { Self::RefsAnnouncement {
node, node,
@ -528,8 +537,13 @@ impl wire::Decode for Message {
Ok(MessageType::Subscribe) => { Ok(MessageType::Subscribe) => {
let filter = Filter::decode(reader)?; let filter = Filter::decode(reader)?;
let since = Timestamp::decode(reader)?; let since = Timestamp::decode(reader)?;
let until = Timestamp::decode(reader)?;
Ok(Self::Subscribe { filter, since }) Ok(Self::Subscribe {
filter,
since,
until,
})
} }
Ok(MessageType::NodeAnnouncement) => { Ok(MessageType::NodeAnnouncement) => {
let node = NodeId::decode(reader)?; let node = NodeId::decode(reader)?;