Replace `EventsProvider` on `OnionMessageHandler` with a single fn
authorMatt Corallo <git@bluematt.me>
Sun, 17 Dec 2023 19:43:28 +0000 (19:43 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 23 Jan 2024 19:55:39 +0000 (19:55 +0000)
commit780cbe9c786944c571ba2a34a82def5fa6b4936e
tree453ac34632e442c4246a474e7364c6d9d3a1b0ef
parent9b338cc4c385ce324ddcd239f4f32b2a04688bc3
Replace `EventsProvider` on `OnionMessageHandler` with a single fn

`OnionMessageHandler`s are expected to regularly release a set of
nodes which we need to directly connect to to deliver onion
messages. In order to do so, they currently extend
`EventsProvider`, returning that set as `Event::ConnectionNeeded`s.

While this works fine in Rust, the `EventsProvider` interface
doesn't map well in bindings due to it taking a flexible trait impl
as a method argument.

Instead, here, we convert `OnionMessageHandler` to include a single
function which returns nodes in the form of a `node_id` and
`Vec<SocketAddress>`. This is a bit simpler, if less flexible, API,
and while largely equivalent, is easier to map in bindings.
lightning-background-processor/src/lib.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/onion_message/messenger.rs