Don't panic at startup when duplicate peers are configured

Fixes #1077
This commit is contained in:
Neil Alexander 2023-10-28 21:28:38 +01:00
parent 7f9d4f3f6d
commit e41b838d8f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 50 additions and 1 deletions

View file

@ -13,7 +13,15 @@ func (c *Core) _applyOption(opt SetupOption) (err error) {
if err != nil {
return fmt.Errorf("unable to parse peering URI: %w", err)
}
return c.links.add(u, v.SourceInterface, linkTypePersistent)
err = c.links.add(u, v.SourceInterface, linkTypePersistent)
switch err {
case ErrLinkAlreadyConfigured:
// Don't return this error, otherwise we'll panic at startup
// if there are multiple of the same peer configured
return nil
default:
return err
}
case ListenAddress:
c.config._listeners[v] = struct{}{}
case NodeInfo: