Skip to content

Commit

Permalink
packages/gossiplog: change push protocol from /canvas/sync/v1/${topic…
Browse files Browse the repository at this point in the history
…}/push to /canvas/push/v1/${topic}
  • Loading branch information
joeltg committed Jun 21, 2024
1 parent 1a8b915 commit eca24f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/gossiplog/src/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { equals } from "uint8arrays"
import { SignedMessage } from "../SignedMessage.js"

export const getSyncProtocol = (topic: string) => `/canvas/sync/v1/${topic}`
export const getPushProtocol = (topic: string) => `/canvas/sync/v1/${topic}/push`
export const getPushProtocol = (topic: string) => `/canvas/push/v1/${topic}`

export type GossipLogServiceComponents = {
peerId: PeerId
Expand Down
9 changes: 3 additions & 6 deletions packages/relay-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,19 @@ getLibp2p().then(async (libp2p) => {
const [_, topic] = key.split("/")
const results: {
id: Uint8Array
addresses: { isCertified: boolean; multiaddr: Uint8Array }[]
addresses: Uint8Array[]
protocols: string[]
peerRecordEnvelope: Uint8Array | null
}[] = []

for (const peerId of topicIndex.get(topic) ?? []) {
const id = peerIdFromString(peerId)
const peer = await libp2p.peerStore.get(id)
const addresses = peer.addresses.map(({ isCertified, multiaddr }) => ({
isCertified,
multiaddr: multiaddr.bytes,
}))
const addresses = peer.addresses.map(({ multiaddr }) => multiaddr.bytes)

results.push({
id: id.toBytes(),
addresses,
addresses: addresses,
protocols: peer.protocols,
peerRecordEnvelope: peer.peerRecordEnvelope ?? null,
})
Expand Down

0 comments on commit eca24f7

Please sign in to comment.