# Message Relaying

[← Back to Protocol Extensions and Quantum Signatures](/core-dev-bootcamp/module05.md)

***

### Introduction

Efficient message propagation is essential for a decentralized ledger. Transactions must reach validators quickly, proposals must spread to enable consensus, and validations must propagate to finalize ledgers. The overlay network's message relaying system ensures information flows efficiently while preventing network overload through intelligent squelching.

This lesson explores how messages propagate through the network and how Rippled optimizes this process to handle high-throughput scenarios.

***

### OverlayImpl::relay

**OverlayImpl::relay(protocol::TMProposeSet& m, uint256 const& uid, PublicKey const& validator)** ([OverlayImpl.cpp](https://github.com/XRPLF/rippled/blob/develop/src/xrpld/overlay/detail/OverlayImpl.cpp)):

* Calls `app_.getHashRouter().shouldRelay(uid)` to determine if the proposal should be relayed.
* If not, returns an empty set.
* If yes:
  * Creates a shared pointer to a Message object containing the proposal.
  * Iterates over all active peers.
  * For each peer not in the skip set, sends the proposal message.
* Returns the set of peer IDs that were skipped.

### Slot::update and Squelch Mechanism

**Slot::update** ([Slot.h](https://github.com/XRPLF/rippled/blob/develop/src/xrpld/overlay/Slot.h)):

* Tracks peer activity for a validator, incrementing message counts and considering peers for selection.
* When enough peers reach the message threshold, randomly selects a subset to be "Selected" and squelches the rest (temporarily mutes them).
* Squelched peers are unsquelched after expiration.
* Handles all state transitions, logging, and squelch/unsquelch notifications via the SquelchHandler interface.

**OverlayImpl::unsquelch** ([OverlayImpl.cpp](https://github.com/XRPLF/rippled/blob/develop/src/xrpld/overlay/detail/OverlayImpl.cpp)):

* Looks up the peer by short ID.
* If found, constructs a TMSquelch message with `squelch=false` for the validator.
* Sends the message to the peer, instructing it to stop squelching messages from the validator.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xrpl-commons.org/core-dev-bootcamp/module05/message-relaying.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
