Avoid querying the chain for outputs for channels we already have 2022-08-no-double-access
authorMatt Corallo <git@bluematt.me>
Sun, 21 Aug 2022 20:34:22 +0000 (20:34 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 23 Aug 2022 17:46:12 +0000 (17:46 +0000)
commit5847abd92db2f5346bdc307ec532df6a3753dec3
treece030353b24cfc17fad177240ad3f5f96e5d8d48
parent19536c6433a8c7138294ba74864d03c3cf4c7aa5
Avoid querying the chain for outputs for channels we already have

If we receive a ChannelAnnouncement message but we already have the
channel, there's no reason to do a chain lookup. Instead of
immediately calling the user-provided `chain::Access` when handling
a ChannelAnnouncement, we first check if we have the corresponding
channel in the graph.

Note that if we do have the corresponding channel but it was not
previously checked against the blockchain, we should still check
with the `chain::Access` and update if necessary.
lightning/src/routing/gossip.rs