Path Discovery and Route Learning
MeshCore uses ana intelligenthybrid pathflood-first discovery/ direct-route-after systemapproach rather than simplepersistent flooding. ThisFor designstable meansrepeat-unicast traffic the network getsquiets quieterdown -as notpaths are learned; under mobility, link churn, or heavy group/broadcast traffic it can get louder -again asbecause usageof increases.re-flooding.
How Path Discovery Works: Step by Step
- First message to an unknown destination - MeshCore floods the network to locate the target node.
EveryThe flooded message carries the payload, and every node relaysthe messageit until it reaches thedestination.destination, recording the path it travelled as a byproduct. - Destination
receivesreturnstheamessagepathand sends an ACKrecord - Theacknowledgementdestinationtravelssends backalongaPAYLOAD_TYPE_PATHpacket containing thediscoveredrecordedpath.path (not merely a generic ACK). RouteSenderisstorescachedthe path -Both theThe original sender records the returned path andallusesrelayit (ROUTE_TYPE_DIRECT, embedding the path) for subsequent messages. Relay nodesalongforward based on the pathrecordembeddedtheinroute.each packet; they do not maintain per-destination route tables. This is the key step: thenetworksender has now "learned" a path.- Subsequent messages use the established path - Only nodes on the known route retransmit. All other nodes stay silent.
- Retry and re-discover - After 3 consecutive failed retries on a known path, MeshCore discards the cached route and floods again to find a new one.
Group and Public Channel Messages
Group messages and public channel broadcasts always flood the network, because they are addressed to multiple destinations and no single path can serve all recipients. Path caching only applies to direct (unicast) messages.
Path Hash Mode
The granularitypath.hash.mode ofsetting controls the cachedpath-hash pathsize identifierused in a node's own advert broadcasts (on a repeater it affects only its advert broadcasts, not which packets it forwards). On companion nodes, the message path-hash size is configurableset viain the CLI:app's Experimental Settings.
set path.hash.mode 0 # 1-byte path hash (default; low overhead)
set path.hash.mode 1 # 2-byte path hash (default; balanced)
set path.hash.mode 2 # 3-byte path hash (highest precision)
A larger hash reduces the chance of path collision in dense networks at the cost of slightly larger packet headers. The firmware default is mode 0 (1 byte); only raise it after confirming the whole network runs firmware that supports the larger size.
Advertisement Broadcasts
Nodes periodically broadcast advertisements so neighbors can discover them. The flood-advert interval is configurable:configurable (in hours):
set flood.advert.interval 6 # broadcast every 6 hours (default is 12)
To trigger an immediate advertisement (useful after changing location or name):, use advert for a flood advert, or advert.zerohop for a zero-hop (neighbors-only) advert:
advert