Fix Peer Deletion & HTTP endpoints (#319)

This commit is contained in:
Misha Bragin
2022-05-21 17:27:04 +02:00
committed by GitHub
parent 3ce3ccc39a
commit 3eb230e1a0
4 changed files with 37 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package server
import (
log "github.com/sirupsen/logrus"
"net"
"strings"
"time"
@@ -262,7 +263,11 @@ func (am *DefaultAccountManager) GetNetworkMap(peerKey string) (*NetworkMap, err
for _, g := range groups {
for _, pid := range g.Peers {
peer := account.Peers[pid]
peer, ok := account.Peers[pid]
if !ok {
log.Warnf("peer %s found in group %s but doesn't belong to account %s", pid, g.ID, account.Id)
continue
}
// exclude original peer
if peer.Key != peerKey {
res = append(res, peer.Copy())