Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(libp2p): update peer store with supported protocols after unhandle #2013

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/libp2p/src/registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class DefaultRegistrar implements Registrar {

// Update self protocols in the peer store
await this.components.peerStore.patch(this.components.peerId, {
protocols: protocolList
protocols: this.getProtocols()
})
}

Expand Down
4 changes: 4 additions & 0 deletions packages/libp2p/test/registrar/registrar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ describe('registrar', () => {
await libp2p.unhandle(['/echo/1.0.0'])
expect(registrar.getProtocols()).to.not.have.any.keys(['/echo/1.0.0'])
expect(registrar.getHandler('/echo/1.0.1')).to.have.property('handler', echoHandler)

await expect(libp2p.peerStore.get(libp2p.peerId)).to.eventually.have.deep.property('protocols', [
'/echo/1.0.1'
])
})
})
})
Loading