Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

fix: response for findpeer and findprovs #1039

Merged
merged 6 commits into from
Jul 10, 2019
Merged

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Jul 10, 2019

Pick out the correct item from the response, do not assume the first is the one we want.

Also calls toString on the CID/PeerID so that we can pass CID instances directly to these functions.

Pick out the correct item from the response, do not assume the first is the one we want.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
alanshaw pushed a commit to libp2p/js-libp2p-delegated-content-routing that referenced this pull request Jul 10, 2019
Depends on:

* [ ] ipfs-inactive/js-ipfs-http-client#1039

cc @achingbrain

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
alanshaw pushed a commit to libp2p/js-libp2p-delegated-content-routing that referenced this pull request Jul 10, 2019
Needed for next js-ipfs release. Had to port some changes from #7

Depends on:

* [ ] ipfs-inactive/js-ipfs-http-client#1039

cc @achingbrain

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and the tests at libp2p/js-libp2p-delegated-peer-routing#10, which are leveraging this, look good as well. 🚀

Alan Shaw added 4 commits July 10, 2019 12:18
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
Go IPFS does not implement this option and the error that was being checked for was a false positive - it was an error to report no providers were found, which is not an error just a fact and this PR fixes this by removing that error and thus causing this test to now fail.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
@alanshaw alanshaw merged commit 5252f50 into master Jul 10, 2019
@alanshaw alanshaw deleted the fix/findpeerprovs-response branch July 10, 2019 12:52
// https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b969bdab/routing/query.go#L18
if (!res || res.Type !== 2) {
const errMsg = `key was not found (type 4)`
return callback(errcode(new Error(errMsg), 'ERR_KEY_TYPE_4_NOT_FOUND'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ERR_KEY_TYPE_2_NOT_FOUND

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants