Expand description
Broadcast messages to and cache messages from untrusted peers.
§Overview
The core of the module is the Engine. It is responsible for:
- Accepting and caching messages from other participants
- Broadcasting messages to all peers
- Serving cached messages on-demand
§Details
The engine receives messages from other peers and caches them. The cache is a bounded queue of messages per peer. When the cache is full, the oldest message is removed to make room for the new one.
The Mailbox is used to make requests to the Engine. It implements the
Broadcaster trait. This is used to have the engine send a message to all
other peers in the network in a best-effort manner. It also has a method to request a message by
digest. The engine will return the message immediately if it is in the cache, or wait for it to
be received over the network if it is not.