delvingbitcoin

Quick peer gossip catchup protocol

Quick peer gossip catchup protocol

Original Postby rustyrussell

Posted on: December 6, 2023 20:01 UTC

The blog post begins by describing the functionality of gossip_timestamp_filter, a feature identified by type 265 and associated with gossip_queries.

This filter operates by utilizing three key pieces of data: the chain_hash, first_timestamp, and timestamp_range. The timestamp in question for channel announcements is linked to the timestamp of a corresponding channel_update.

It is noted that common practice has seen the usage of terms "none," "all," or "recent" when referencing timestamps, with different implementations defining "recent" as ranging from 10 minutes to an hour in the past. In an effort to streamline the process without the need to scan the entire gossip store or maintain additional metadata, an optimization has been introduced. This involves maintaining a single offset for the first record with a timestamp greater than two hours old and scanning from that point, unless the first_update is explicitly set to 0. This effectively reduces the potential values of the first timestamp field to three distinct states.

However, this method does not ideally serve the needs of a single-peer-gossiper who benefits more from knowing when a peer received the gossip rather than when the record itself was timestamped. Since peers typically begin streaming gossip within 60 seconds of reception, tracking reception time provides a more accurate measure of whether the information is new to the peer. To achieve efficiency, the system can store the received timestamps at approximately every megabyte of gossip data, taking advantage of their monotonic nature.