Skip to content

Commit a0a541d

Browse files
committed
small revise
1 parent 1b90ec7 commit a0a541d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

p2p/discovery.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
const DiscoveryProtocol = "/tss/discovery/1.0.0"
19-
const GossipInterval = 3 * time.Second
19+
const GossipInterval = 10 * time.Second
2020

2121
type PeerDiscovery struct {
2222
host host.Host
@@ -166,7 +166,7 @@ func (pd *PeerDiscovery) gossipPeers(ctx context.Context) {
166166
continue
167167
}
168168
for _, p := range recvPeers {
169-
pd.logger.Info().Msgf("Adding peer %s", p)
169+
pd.logger.Debug().Msgf("Adding peer %s", p)
170170
pd.addPeer(p)
171171
}
172172

tss/tss.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,16 @@ func (t *TssServer) GetLocalPeerID() string {
232232
}
233233

234234
// GetKnownPeers return the the ID and IP address of all peers.
235-
func (t *TssServer) GetKnownPeers() []PeerInfo {
236-
infos := []PeerInfo{}
235+
func (t *TssServer) GetKnownPeers() []peer.AddrInfo {
236+
var infos []peer.AddrInfo
237237
host := t.p2pCommunication.GetHost()
238238

239239
for _, conn := range host.Network().Conns() {
240-
peer := conn.RemotePeer()
240+
p := conn.RemotePeer()
241241
addrs := conn.RemoteMultiaddr()
242-
ip, _ := addrs.ValueForProtocol(maddr.P_IP4)
243-
pi := PeerInfo{
244-
ID: peer.String(),
245-
Address: ip,
242+
pi := peer.AddrInfo{
243+
p,
244+
[]maddr.Multiaddr{addrs},
246245
}
247246
infos = append(infos, pi)
248247
}

0 commit comments

Comments
 (0)