Module lightning::util::events

source ·
Expand description

Events are returned from various bits in the library which indicate some action must be taken by the client.

Because we don’t have a built-in runtime, its up to the client to call events at a time in the future, as well as generate and broadcast funding transactions handle payment preimages and a few other things.

Note that many events are handled for you by PeerHandler, so in the common design of having a PeerManager which marshalls messages to ChannelManager and Router you only need to call process_events on the PeerHandler and then get_and_clear_pending_events and handle the events that bubble up to the surface. If, however, you do not have a PeerHandler managing a ChannelManager you need to handle all of the events which may be generated.

Enums

An Event which you should probably take some action in response to.
An event generated by ChannelManager which indicates a message should be sent to a peer (or broadcast to most peers). These events are handled by PeerManager::process_events if you are using a PeerManager.

Traits

A trait indicating an object may generate events
A trait indicating an object may generate message send events