htlcswitch: in event of duplicate link add, prefer newer link
This commit is contained in:
3 files changed
+5
-64
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user