Skip to content

Commit ce0fe4a

Browse files
committed
prevent replication servers from peering with each other
1 parent e88792c commit ce0fe4a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/replication-server/src/libp2p.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ async function denyDialMultiaddr(addr: Multiaddr) {
3838
return true
3939
}
4040

41+
if (
42+
bootstrapList
43+
.map(multiaddr)
44+
.map((addr) => addr.getPeerId()?.toString())
45+
.indexOf(peerId.toString())
46+
) {
47+
return true
48+
}
49+
4150
return false
4251
}
4352

@@ -105,11 +114,11 @@ export const options: Libp2pOptions<ServiceMap> = {
105114
fallbackToFloodsub: false,
106115
allowPublishToZeroPeers: true,
107116
globalSignaturePolicy: "StrictNoSign",
108-
directPeers: bootstrapList.map(multiaddr).map((addr) => {
109-
const id = addr.getPeerId()
110-
assert(id !== null)
111-
return { id: peerIdFromString(id), addrs: [addr] }
112-
}),
117+
// directPeers: bootstrapList.map(multiaddr).map((addr) => {
118+
// const id = addr.getPeerId()
119+
// assert(id !== null)
120+
// return { id: peerIdFromString(id), addrs: [addr] }
121+
// }),
113122
scoreParams: {
114123
behaviourPenaltyWeight: -1.0, // 1/10th of default
115124
retainScore: 10 * 1000, // 10 seconds, instead of 1 hour

0 commit comments

Comments
 (0)