Drop `PeerManager` type bound on `UtxoLookup` entirely 2024-01-pm-dyn-ref
authorMatt Corallo <git@bluematt.me>
Wed, 10 Jan 2024 22:24:43 +0000 (22:24 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 10 Jan 2024 22:33:43 +0000 (22:33 +0000)
commit370339919d1a4fdec9bb9bc509f0d8483866fd04
treec5518dbce13ef2708b9a0755052434d5be0d7890
parent4deb2631dccfe787c8bc1f34b44bcd6f77ad80cd
Drop `PeerManager` type bound on `UtxoLookup` entirely

In 67659677d4fdb6bf418d66dfa37c61706425232b we relaxed the bounds
set on `UtxoLookup` to enable those using `RoutingMessageHandler`
other than `P2PGossipSync` to use `UtxoLookup`. Sadly, because this
requires having a concrete `PeerManager` type which does *not* use
`UtxoLookup` in the `RoutingMessageHandler` type, this broke users
who were directly using `P2PGossipSync`.

We could split `UtxoLookup` into two, with different bounds, for
the two use-cases, but instead here we simply switch to storing a
reference to the `PeerManager` via a `dyn Fn` which allows us to
wake the `PeerManager` when we need to.

Fixes #2813
lightning-block-sync/src/gossip.rs