policy/v2: fix via grants in BuildPeerMap, MatchersForNode, and ViaRoutesForPeer

Use per-node compilation path for via grants in BuildPeerMap and MatchersForNode to ensure via-granted nodes appear in peer maps. Fix ViaRoutesForPeer golden test route inference to correctly resolve via grant effects.

Updates #2180
This commit is contained in:
Kristoffer Dalby
2026-03-28 12:48:19 +00:00
parent 6a55f7d731
commit c36cedc32f
3 changed files with 244 additions and 95 deletions

View File

@@ -693,7 +693,11 @@ func (s *State) ListPeers(nodeID types.NodeID, peerIDs ...types.NodeID) views.Sl
return s.nodeStore.ListPeers(nodeID)
}
// For specific peerIDs, filter from all nodes
// For specific peerIDs, filter from all nodes.
// This path is used for incremental updates (NodeAdded, NodeChanged)
// where the caller already knows which peer IDs are involved.
// The peer visibility filtering happens in the mapper's buildTailPeers
// via MatchersForNode/ReduceNodes.
allNodes := s.nodeStore.ListNodes()
nodeIDSet := make(map[types.NodeID]struct{}, len(peerIDs))