htlcswitch: in event of duplicate link add, prefer newer link

This commit is contained in:
Olaoluwa Osuntokun committed 2018-06-12 00:44:30 -07:00
1 parent e1d8c37708
commit e60d2b774a
3 files changed
+5 -64

No files matched your search

+3 -3
View File
@@ -1723,11 +1723,11 @@ func (s *Switch) AddLink(link ChannelLink) error {
chanID := link.ChanID()
// First, ensure that this link is not already active in the switch.
// If a link already exists, then remove the prior one so we can
// replace it with this fresh instance.
_, err := s.getLink(chanID)
if err == nil {
return fmt.Errorf("unable to add ChannelLink(%v), already "+
"active", chanID)
s.removeLink(chanID)
}
// Get and attach the mailbox for this link, which buffers packets in