diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index dcb6714d..d99d0182 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -202,8 +202,8 @@ type Switch struct { forwardingIndex map[lnwire.ShortChannelID]ChannelLink // interfaceIndex maps the compressed public key of a peer to all the - // channels that the switch maintains iwht that peer. - interfaceIndex map[[33]byte]map[ChannelLink]struct{} + // channels that the switch maintains with that peer. + interfaceIndex map[[33]byte]map[lnwire.ChannelID]ChannelLink // htlcPlex is the channel which all connected links use to coordinate // the setup/teardown of Sphinx (onion routing) payment circuits. @@ -253,7 +253,7 @@ func New(cfg Config) (*Switch, error) { linkIndex: make(map[lnwire.ChannelID]ChannelLink), mailOrchestrator: newMailOrchestrator(), forwardingIndex: make(map[lnwire.ShortChannelID]ChannelLink), - interfaceIndex: make(map[[33]byte]map[ChannelLink]struct{}), + interfaceIndex: make(map[[33]byte]map[lnwire.ChannelID]ChannelLink), pendingLinkIndex: make(map[lnwire.ChannelID]ChannelLink), pendingPayments: make(map[uint64]*pendingPayment), htlcPlex: make(chan *plexPacket), @@ -1774,9 +1774,9 @@ func (s *Switch) addLiveLink(link ChannelLink) { // quickly look up all the channels for a particular node. peerPub := link.Peer().PubKey() if _, ok := s.interfaceIndex[peerPub]; !ok { - s.interfaceIndex[peerPub] = make(map[ChannelLink]struct{}) + s.interfaceIndex[peerPub] = make(map[lnwire.ChannelID]ChannelLink) } - s.interfaceIndex[peerPub][link] = struct{}{} + s.interfaceIndex[peerPub][link.ChanID()] = link } // GetLink is used to initiate the handling of the get link command. The @@ -1918,7 +1918,7 @@ func (s *Switch) getLinks(destination [33]byte) ([]ChannelLink, error) { } channelLinks := make([]ChannelLink, 0, len(links)) - for link := range links { + for _, link := range links { channelLinks = append(channelLinks, link) }