fix: add incoming peer to ip block too, and add more logging

This commit is contained in:
Derrick Hammer 2024-01-15 11:45:25 -05:00
parent ab53dbdf08
commit bbb407b0e1
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -244,13 +244,18 @@ func (p *P2PImpl) ConnectToNode(connectionUris []*url.URL, retried bool, fromPee
if err != nil {
return err
}
fromPeerIP := fromPeer.GetIP()
p.incomingPeerBlockList.Put(fromPeerId, true)
p.incomingIPBlocklist.Put(fromPeerIP, true)
err = fromPeer.End()
if err != nil {
return err
}
p.logger.Info("blocking peer for sending peer on blocklist", zap.String("node", connectionUri.String()), zap.String("peer", fromPeerId), zap.String("ip", fromPeerIP))
}
p.outgoingPeerBlocklist.Put(idString, true)
p.logger.Info("blocking peer for too many failures", zap.String("node", connectionUri.String()))
}
return nil