X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ARCH.md;h=5b9304cce009f8d9b3eb1a7fcff3721fc3efb094;hb=refs%2Fheads%2F2021-07-broken-beta;hp=237a85557b1f2d15e26a8e3ce43a880e5cd3211f;hpb=82c81357e26800c15f13290955705c9efabc5411;p=rust-lightning diff --git a/ARCH.md b/ARCH.md index 237a8555..5b9304cc 100644 --- a/ARCH.md +++ b/ARCH.md @@ -6,16 +6,16 @@ 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. `Router` handles receiving channel and node -announcements and calculates routes for sending payments. `PeerManager` handles the -authenticated and encrypted communication protocol, monitoring for liveness of peers, -routing messages to `ChannelManager` and `Router` instances directly, and receiving -messages from them via the `EventsProvider` interface. +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` +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 a proxy in between for special handling. Further, APIs for key generation, transaction @@ -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 |- | \ / / ---------------- | -------\---/---------- - | ----------------------- / \ / - | | ChainWatchInterface | - v - | ----------------------- --------- - | | | Event | -(as RoutingMessageHandler) v --------- - \ ---------- - -----------------> | Router | - ---------- + -------------------- ^ -------------- + ------| MessageSendEvent | | ^ ---------------- + / -------------------- | | | FeeEstimator | <----------------------- + | (as MessageSendEventsProvider) | | ---------------- \ + | ^ | | ^ ------------------------ | + | \ | | / ---------> | BroadcasterInterface | | + | \ | | / / ------------------------ | + | \ | | / / ^ | + | (as ------------------ ---------------- | | + | ChannelMessageHandler)-> | ChannelManager | ----> | chain::Watch | | | + v / ------------------ ---------------- | | +--------------- / (as EventsProvider) ^ | | +| PeerManager |- \ | | | +--------------- \ | (is-a) | | + | ----------------- \ _---------------- / / + | | chain::Access | \ / | ChainMonitor |--------------- + | ----------------- \ / ---------------- + | ^ \ / | +(as RoutingMessageHandler) | v v + \ ---------------------- --------- ----------------- + -----------------> | NetGraphMsgHandler | | Event | | chain::Filter | + ---------------------- --------- ----------------- ```