X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ARCH.md;h=bd5fc1bd3164a5ce749ade66c19bb55f6fd74700;hb=refs%2Fheads%2Fupstream%2Fmain;hp=061c0ba4f8330145f5d965a8550aed8676ef6acb;hpb=3ee6a27bc6cef28ba52059a405913ca5c6e1dcb7;p=rust-lightning diff --git a/ARCH.md b/ARCH.md index 061c0ba4..bd5fc1bd 100644 --- a/ARCH.md +++ b/ARCH.md @@ -6,15 +6,15 @@ need to use are `ChannelManager` and `ChannelMonitor`. `ChannelManager` holds mu channels, routes payments between them, and exposes a simple API to make and receive payments. Individual `ChannelMonitor`s monitor the on-chain state of a channel, punish counterparties if they misbehave, and force-close channels if they contain unresolved -HTLCs which are near expiration. The `ManyChannelMonitor` API provides a way for you to +HTLCs which are near expiration. The `chain::Watch` interface provides a way for you to receive `ChannelMonitorUpdate`s from `ChannelManager` and persist them to disk before the channel steps forward. There are two additional important structures that you may use either on the same device -as the `ChannelManager` or on a separate one. `NetGraphMsgHandler` handles receiving channel -and node announcements, which are then used to calculate routes by `get_route` for sending payments. -`PeerManager` handles the authenticated and encrypted communication protocol, -monitoring for liveness of peers, routing messages to `ChannelManager` and `NetGraphMsgHandler` +as the `ChannelManager` or on a separate one. `P2PGossipSync` handles receiving channel +and node announcements, which are then used to calculate routes by `find_route` for sending +payments. `PeerManager` handles the authenticated and encrypted communication protocol, +monitoring for liveness of peers, routing messages to `ChannelManager` and `P2PGossipSync` instances directly, and receiving messages from them via the `EventsProvider` interface. These structs communicate with each other using a public API, so that you can easily add @@ -37,26 +37,26 @@ At a high level, some of the common interfaces fit together as follows: ----------------- | KeysInterface | -------------- ----------------- | UserConfig | - -------------------- | -------------- - /------| MessageSendEvent | | | ---------------- - | -------------------- | | | FeeEstimator | - | (as MessageSendEventsProvider) | | ---------------- - | ^ | | / | ------------------------ - | \ | | / ---------> | BroadcasterInterface | - | \ | | / / | ------------------------ - | \ v v v / v ^ - | (as ------------------ ---------------------- - | ChannelMessageHandler)-> | ChannelManager | ----> | ManyChannelMonitor | - v / ------------------ ---------------------- ---------------- / (as EventsProvider) -| PeerManager |- \ / ---------------- \ / - | ----------------- \ / - | | chain::Access | v - | ----------------- --------- - | | | Event | -(as RoutingMessageHandler) v --------- - \ -------------------- - -----------------> | NetGraphMsgHandler | - -------------------- + -------------------- ^ -------------- + ------| MessageSendEvent | | ^ ---------------- + / -------------------- | | | FeeEstimator | <----------------------- + | (as MessageSendEventsProvider) | | ---------------- \ + | ^ | | ^ ------------------------ | + | \ | | / ---------> | BroadcasterInterface | | + | \ | | / / ------------------------ | + | \ | | / / ^ | + | (as ------------------ ---------------- | | + | ChannelMessageHandler)-> | ChannelManager | ----> | chain::Watch | | | + v / ------------------ ---------------- | | +--------------- / (as EventsProvider) ^ | | +| PeerManager |- \ | | | +--------------- \ | (is-a) | | + | -------------- \ _---------------- / / + | | UtxoLookup | \ / | ChainMonitor |--------------- + | -------------- \ / ---------------- + | ^ \ / | +(as RoutingMessageHandler) | v v + \ ----------------- --------- ----------------- + -----------------> | P2PGossipSync | | Event | | chain::Filter | + ----------------- --------- ----------------- ```