Skip to main content

PlannerCacheKey

Type Alias PlannerCacheKey 

Source
type PlannerCacheKey = (OffchainPublicKey, OffchainPublicKey, u32);
Expand description

Cache key for the path planner: (source, destination, hops).

Only the Hops variant of RoutingOptions is cached (explicit intermediate paths bypass the cache), so the key stores the hop count as a plain u32.

Keyed on resolved offchain keys rather than [NodeId], because a NodeId naming a node by its chain address is never equal to one naming the same node by its packet key. Callers hold whichever form their layer happens to use – Sessions carry chain addresses, the SURB telemetry reports packet keys – so a raw-NodeId key silently stores the same route twice. Resolving first makes lookup and insertion agree by construction.