[−][src]Module lightning::ln::channelmanager
The top-level channel management and payment tracking stuff lives here.
The ChannelManager is the main chunk of logic implementing the lightning protocol and is responsible for tracking which channels are open, HTLCs are in flight and reestablishing those upon reconnect to the relevant peer(s).
It does not manage routing logic (see routing::router::get_route for that) nor does it manage constructing on-chain transactions (it only monitors the chain to watch for any force-closes that might imply it needs to fail HTLCs/payments/channels it manages).
Structs
ChannelDetails | Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels |
ChannelManager | Manager which keeps track of a number of channels and sends messages to the appropriate channel, also tracking HTLC preimages and forwarding onion packets appropriately. |
ChannelManagerReadArgs | Arguments for the creation of a ChannelManager that are not deserialized. |
PaymentHash | payment_hash type, use to cross-lock hop (C-not exported) as we just use [u8; 32] directly |
PaymentPreimage | payment_preimage type, use to route payment between hop (C-not exported) as we just use [u8; 32] directly |
PaymentSecret | payment_secret type, use to authenticate sender to the receiver and tie MPP HTLCs together (C-not exported) as we just use [u8; 32] directly |
Enums
PaymentSendFailure | If a payment fails to send, it can be in one of several states. This enum is returned as the Err() type describing which state the payment is in, see the description of individual enum states for more. |
Type Definitions
SimpleArcChannelManager | SimpleArcChannelManager is useful when you need a ChannelManager with a static lifetime, e.g. when you're using lightning-net-tokio (since tokio::spawn requires parameters with static lifetimes). Other times you can afford a reference, which is more efficient, in which case SimpleRefChannelManager is the more appropriate type. Defining these type aliases prevents issues such as overly long function definitions. Note that the ChannelManager can take any type that implements KeysInterface for its keys manager, but this type alias chooses the concrete type of the KeysManager. |
SimpleRefChannelManager | SimpleRefChannelManager is a type alias for a ChannelManager reference, and is the reference counterpart to the SimpleArcChannelManager type alias. Use this type by default when you don't need a ChannelManager with a static lifetime. You'll need a static lifetime in cases such as usage of lightning-net-tokio (since tokio::spawn requires parameters with static lifetimes). But if this is not necessary, using a reference is more efficient. Defining these type aliases helps with issues such as long function definitions. Note that the ChannelManager can take any type that implements KeysInterface for its keys manager, but this type alias chooses the concrete type of the KeysManager. |