{"action":"created","comment":{"url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/comments/204496287","pull_request_review_id":139584100,"id":204496287,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDQ5NjI4Nw==","diff_hunk":"@@ -0,0 +1,270 @@\n+package dht\n+\n+import (\n+\t\"encoding/hex\"\n+\t\"errors\"\n+\t\"github.com/btcsuite/btcutil/base58\"\n+\t\"github.com/gogo/protobuf/proto\"\n+\t\"github.com/spacemeshos/go-spacemesh/crypto\"\n+\t\"github.com/spacemeshos/go-spacemesh/p2p/dht/pb\"\n+\t\"github.com/spacemeshos/go-spacemesh/p2p/node\"\n+\t\"github.com/spacemeshos/go-spacemesh/p2p/service\"\n+\t\"sync\"\n+\t\"time\"\n+)\n+\n+// todo: should be a kad param and configurable\n+const maxNearestNodesResults = 20\n+const tableQueryTimeout = time.Minute * 1\n+\n+// Protocol name\n+const protocol = \"/dht/1.0/find-node/\"\n+\n+// ErrEncodeFailed is returned when we failed to encode data to byte array\n+var ErrEncodeFailed = errors.New(\"failed to encode data\")\n+\n+type findNodeResults struct {","path":"p2p/dht/findnode.go","position":26,"original_position":26,"commit_id":"01d97d424bcc30d6de187dfaa10ef27d17bddf6d","original_commit_id":"01d97d424bcc30d6de187dfaa10ef27d17bddf6d","user":{"login":"kenze1","id":21037839,"node_id":"MDQ6VXNlcjIxMDM3ODM5","avatar_url":"https://avatars3.githubusercontent.com/u/21037839?v=4","gravatar_id":"","url":"https://api.github.com/users/kenze1","html_url":"https://github.com/kenze1","followers_url":"https://api.github.com/users/kenze1/followers","following_url":"https://api.github.com/users/kenze1/following{/other_user}","gists_url":"https://api.github.com/users/kenze1/gists{/gist_id}","starred_url":"https://api.github.com/users/kenze1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenze1/subscriptions","organizations_url":"https://api.github.com/users/kenze1/orgs","repos_url":"https://api.github.com/users/kenze1/repos","events_url":"https://api.github.com/users/kenze1/events{/privacy}","received_events_url":"https://api.github.com/users/kenze1/received_events","type":"User","site_admin":false},"body":"I'd consider refactor by switching the error and results, it's more intuitive","created_at":"2018-07-23T17:48:44Z","updated_at":"2018-07-23T17:48:44Z","html_url":"https://github.com/spacemeshos/go-spacemesh/pull/174#discussion_r204496287","pull_request_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/comments/204496287"},"html":{"href":"https://github.com/spacemeshos/go-spacemesh/pull/174#discussion_r204496287"},"pull_request":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174","id":203224541,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzMjI0NTQx","html_url":"https://github.com/spacemeshos/go-spacemesh/pull/174","diff_url":"https://github.com/spacemeshos/go-spacemesh/pull/174.diff","patch_url":"https://github.com/spacemeshos/go-spacemesh/pull/174.patch","issue_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/174","number":174,"state":"open","locked":false,"title":"Refactor 0.5","user":{"login":"kenze1","id":21037839,"node_id":"MDQ6VXNlcjIxMDM3ODM5","avatar_url":"https://avatars3.githubusercontent.com/u/21037839?v=4","gravatar_id":"","url":"https://api.github.com/users/kenze1","html_url":"https://github.com/kenze1","followers_url":"https://api.github.com/users/kenze1/followers","following_url":"https://api.github.com/users/kenze1/following{/other_user}","gists_url":"https://api.github.com/users/kenze1/gists{/gist_id}","starred_url":"https://api.github.com/users/kenze1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenze1/subscriptions","organizations_url":"https://api.github.com/users/kenze1/orgs","repos_url":"https://api.github.com/users/kenze1/repos","events_url":"https://api.github.com/users/kenze1/events{/privacy}","received_events_url":"https://api.github.com/users/kenze1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-23T13:45:51Z","updated_at":"2018-07-23T17:48:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a88d9d14da7f20e96dd175be8f330b794c046bc4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174/commits","review_comments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174/comments","review_comment_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/174/comments","statuses_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/statuses/01d97d424bcc30d6de187dfaa10ef27d17bddf6d","head":{"label":"spacemeshos:refactor-0.5","ref":"refactor-0.5","sha":"01d97d424bcc30d6de187dfaa10ef27d17bddf6d","user":{"login":"spacemeshos","id":33087498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMDg3NDk4","avatar_url":"https://avatars2.githubusercontent.com/u/33087498?v=4","gravatar_id":"","url":"https://api.github.com/users/spacemeshos","html_url":"https://github.com/spacemeshos","followers_url":"https://api.github.com/users/spacemeshos/followers","following_url":"https://api.github.com/users/spacemeshos/following{/other_user}","gists_url":"https://api.github.com/users/spacemeshos/gists{/gist_id}","starred_url":"https://api.github.com/users/spacemeshos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacemeshos/subscriptions","organizations_url":"https://api.github.com/users/spacemeshos/orgs","repos_url":"https://api.github.com/users/spacemeshos/repos","events_url":"https://api.github.com/users/spacemeshos/events{/privacy}","received_events_url":"https://api.github.com/users/spacemeshos/received_events","type":"Organization","site_admin":false},"repo":{"id":108372143,"node_id":"MDEwOlJlcG9zaXRvcnkxMDgzNzIxNDM=","name":"go-spacemesh","full_name":"spacemeshos/go-spacemesh","owner":{"login":"spacemeshos","id":33087498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMDg3NDk4","avatar_url":"https://avatars2.githubusercontent.com/u/33087498?v=4","gravatar_id":"","url":"https://api.github.com/users/spacemeshos","html_url":"https://github.com/spacemeshos","followers_url":"https://api.github.com/users/spacemeshos/followers","following_url":"https://api.github.com/users/spacemeshos/following{/other_user}","gists_url":"https://api.github.com/users/spacemeshos/gists{/gist_id}","starred_url":"https://api.github.com/users/spacemeshos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacemeshos/subscriptions","organizations_url":"https://api.github.com/users/spacemeshos/orgs","repos_url":"https://api.github.com/users/spacemeshos/repos","events_url":"https://api.github.com/users/spacemeshos/events{/privacy}","received_events_url":"https://api.github.com/users/spacemeshos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spacemeshos/go-spacemesh","description":"Go Implementation of the Spacemesh blockmesh p2p node. 💾⏰💪","fork":false,"url":"https://api.github.com/repos/spacemeshos/go-spacemesh","forks_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/forks","keys_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/teams","hooks_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/hooks","issue_events_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/events{/number}","events_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/events","assignees_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/assignees{/user}","branches_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/branches{/branch}","tags_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/tags","blobs_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/statuses/{sha}","languages_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/languages","stargazers_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/stargazers","contributors_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/contributors","subscribers_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/subscribers","subscription_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/subscription","commits_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/contents/{+path}","compare_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/merges","archive_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/downloads","issues_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues{/number}","pulls_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls{/number}","milestones_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/milestones{/number}","notifications_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/labels{/name}","releases_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/releases{/id}","deployments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/deployments","created_at":"2017-10-26T06:43:09Z","updated_at":"2018-07-23T09:43:31Z","pushed_at":"2018-07-23T17:00:50Z","git_url":"git://github.com/spacemeshos/go-spacemesh.git","ssh_url":"git@github.com:spacemeshos/go-spacemesh.git","clone_url":"https://github.com/spacemeshos/go-spacemesh.git","svn_url":"https://github.com/spacemeshos/go-spacemesh","homepage":"https://spacemesh.io","size":15166,"stargazers_count":130,"watchers_count":130,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":49,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":26,"open_issues":49,"watchers":130,"default_branch":"develop"}},"base":{"label":"spacemeshos:develop","ref":"develop","sha":"fb3af280e26293d1e2c86463798e6817dba1f8e5","user":{"login":"spacemeshos","id":33087498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMDg3NDk4","avatar_url":"https://avatars2.githubusercontent.com/u/33087498?v=4","gravatar_id":"","url":"https://api.github.com/users/spacemeshos","html_url":"https://github.com/spacemeshos","followers_url":"https://api.github.com/users/spacemeshos/followers","following_url":"https://api.github.com/users/spacemeshos/following{/other_user}","gists_url":"https://api.github.com/users/spacemeshos/gists{/gist_id}","starred_url":"https://api.github.com/users/spacemeshos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacemeshos/subscriptions","organizations_url":"https://api.github.com/users/spacemeshos/orgs","repos_url":"https://api.github.com/users/spacemeshos/repos","events_url":"https://api.github.com/users/spacemeshos/events{/privacy}","received_events_url":"https://api.github.com/users/spacemeshos/received_events","type":"Organization","site_admin":false},"repo":{"id":108372143,"node_id":"MDEwOlJlcG9zaXRvcnkxMDgzNzIxNDM=","name":"go-spacemesh","full_name":"spacemeshos/go-spacemesh","owner":{"login":"spacemeshos","id":33087498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMDg3NDk4","avatar_url":"https://avatars2.githubusercontent.com/u/33087498?v=4","gravatar_id":"","url":"https://api.github.com/users/spacemeshos","html_url":"https://github.com/spacemeshos","followers_url":"https://api.github.com/users/spacemeshos/followers","following_url":"https://api.github.com/users/spacemeshos/following{/other_user}","gists_url":"https://api.github.com/users/spacemeshos/gists{/gist_id}","starred_url":"https://api.github.com/users/spacemeshos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacemeshos/subscriptions","organizations_url":"https://api.github.com/users/spacemeshos/orgs","repos_url":"https://api.github.com/users/spacemeshos/repos","events_url":"https://api.github.com/users/spacemeshos/events{/privacy}","received_events_url":"https://api.github.com/users/spacemeshos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spacemeshos/go-spacemesh","description":"Go Implementation of the Spacemesh blockmesh p2p node. 💾⏰💪","fork":false,"url":"https://api.github.com/repos/spacemeshos/go-spacemesh","forks_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/forks","keys_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/teams","hooks_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/hooks","issue_events_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/events{/number}","events_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/events","assignees_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/assignees{/user}","branches_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/branches{/branch}","tags_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/tags","blobs_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/statuses/{sha}","languages_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/languages","stargazers_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/stargazers","contributors_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/contributors","subscribers_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/subscribers","subscription_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/subscription","commits_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/contents/{+path}","compare_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/merges","archive_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/downloads","issues_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues{/number}","pulls_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls{/number}","milestones_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/milestones{/number}","notifications_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/labels{/name}","releases_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/releases{/id}","deployments_url":"https://api.github.com/repos/spacemeshos/go-spacemesh/deployments","created_at":"2017-10-26T06:43:09Z","updated_at":"2018-07-23T09:43:31Z","pushed_at":"2018-07-23T17:00:50Z","git_url":"git://github.com/spacemeshos/go-spacemesh.git","ssh_url":"git@github.com:spacemeshos/go-spacemesh.git","clone_url":"https://github.com/spacemeshos/go-spacemesh.git","svn_url":"https://github.com/spacemeshos/go-spacemesh","homepage":"https://spacemesh.io","size":15166,"stargazers_count":130,"watchers_count":130,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":49,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":26,"open_issues":49,"watchers":130,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174"},"html":{"href":"https://github.com/spacemeshos/go-spacemesh/pull/174"},"issue":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/174"},"comments":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/spacemeshos/go-spacemesh/statuses/01d97d424bcc30d6de187dfaa10ef27d17bddf6d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kenze1"}}