def get_gossip_in_timespan(self, timespan: GossipTimestampFilter) \
        -> List[GossipForwardingMessage]:
        """Return a list of gossip messages matching the requested timespan."""
        forwarding_gossip = []
        with self.lock:
            chans = self._channels.copy()
            policies = self._policies.copy()
            nodes = self._nodes.copy()

        for short_id, chan in chans.items():
            # fetching the timestamp from the channel update (according to BOLT-07)
            chan_up_n1 = policies.get((chan.node1_id, short_id))
            chan_up_n2 = policies.get((chan.node2_id, short_id))
            updates = []
            for policy in [chan_up_n1, chan_up_n2]:
                if policy and policy.raw and timespan.in_range(policy.timestamp):
                    if policy.message_flags & 0b10 == 0:  # check that its not "dont_forward"
                        updates.append(GossipForwardingMessage(
                            msg=policy.raw,
                            timestamp=policy.timestamp))
            if not updates or chan.raw is None:
                continue
            chan_ann_ts = min(update.timestamp for update in updates)
            channel_announcement = GossipForwardingMessage(msg=chan.raw, timestamp=chan_ann_ts)
            forwarding_gossip.extend([channel_announcement] + updates)

        for node_ann in nodes.values():
            if timespan.in_range(node_ann.timestamp) and node_ann.raw:
                forwarding_gossip.append(GossipForwardingMessage(
                    msg=node_ann.raw,
                    timestamp=node_ann.timestamp))
        return forwarding_gossip
Return a list of gossip messages matching the requested timespan.
electrum/channel_db.py