{"action":"created","comment":{"url":"https://api.github.com/repos/input-output-hk/mantis/pulls/comments/232906974","pull_request_review_id":174205061,"id":232906974,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjkwNjk3NA==","diff_hunk":"@@ -95,10 +94,11 @@ class PeerDiscoveryManager(\n       case ServerStatus.Listening(address) =>\n         val from = Endpoint.makeEndpoint(address, getTcpPort)\n         val ping = Ping(ProtocolVersion, from, toEndpoint, expirationTimestamp)\n-        getPacketData(ping).foreach{ key =>\n+        val packet = encodePacket(ping, nodeStatusHolder.get().key)\n+        getPacketData(packet).foreach{ key =>","path":"src/main/scala/io/iohk/ethereum/network/discovery/PeerDiscoveryManager.scala","position":47,"original_position":47,"commit_id":"ae50648d0f9c6040f44af13e8818d4147a9f7db8","original_commit_id":"ae50648d0f9c6040f44af13e8818d4147a9f7db8","user":{"login":"KonradStaniec","id":10688236,"node_id":"MDQ6VXNlcjEwNjg4MjM2","avatar_url":"https://avatars2.githubusercontent.com/u/10688236?v=4","gravatar_id":"","url":"https://api.github.com/users/KonradStaniec","html_url":"https://github.com/KonradStaniec","followers_url":"https://api.github.com/users/KonradStaniec/followers","following_url":"https://api.github.com/users/KonradStaniec/following{/other_user}","gists_url":"https://api.github.com/users/KonradStaniec/gists{/gist_id}","starred_url":"https://api.github.com/users/KonradStaniec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KonradStaniec/subscriptions","organizations_url":"https://api.github.com/users/KonradStaniec/orgs","repos_url":"https://api.github.com/users/KonradStaniec/repos","events_url":"https://api.github.com/users/KonradStaniec/events{/privacy}","received_events_url":"https://api.github.com/users/KonradStaniec/received_events","type":"User","site_admin":false},"body":"Maybe it would be better to not create `Packet` object ? I mean now it is created in :\r\nhttps://github.com/input-output-hk/mantis/pull/608/files#diff-9fc6e18903892ffc78f87ca4811bb1c5R101 and\r\nhttps://github.com/input-output-hk/mantis/pull/608/files#diff-9fc6e18903892ffc78f87ca4811bb1c5R117\r\nand it is possibly high cost operation ( each packet has `val nodeId` which is calculated from public key).\r\nAnd all we need is two `ByteStrings` which we can recover from encoded packet in line `97` like:\r\n`val packetMdc          = packet.take(Packet.MdcLength)` and\r\n`val packetDataHash = crypto.kec256(packet.drop(Packet.DataOffset))`.\r\n\r\nSecond option is to make `nodeId` a `lazy val`, but then we would need to change `decodePacket` as now it is using `.get` on `nodeId` to signalize error.\r\n","created_at":"2018-11-13T06:05:31Z","updated_at":"2018-11-13T06:09:45Z","html_url":"https://github.com/input-output-hk/mantis/pull/608#discussion_r232906974","pull_request_url":"https://api.github.com/repos/input-output-hk/mantis/pulls/608","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/comments/232906974"},"html":{"href":"https://github.com/input-output-hk/mantis/pull/608#discussion_r232906974"},"pull_request":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/608"}}},"pull_request":{"url":"https://api.github.com/repos/input-output-hk/mantis/pulls/608","id":229692454,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5NjkyNDU0","html_url":"https://github.com/input-output-hk/mantis/pull/608","diff_url":"https://github.com/input-output-hk/mantis/pull/608.diff","patch_url":"https://github.com/input-output-hk/mantis/pull/608.patch","issue_url":"https://api.github.com/repos/input-output-hk/mantis/issues/608","number":608,"state":"open","locked":false,"title":"EC-596 - Improve our handling of sending discovery message","user":{"login":"mmrozek","id":2864259,"node_id":"MDQ6VXNlcjI4NjQyNTk=","avatar_url":"https://avatars1.githubusercontent.com/u/2864259?v=4","gravatar_id":"","url":"https://api.github.com/users/mmrozek","html_url":"https://github.com/mmrozek","followers_url":"https://api.github.com/users/mmrozek/followers","following_url":"https://api.github.com/users/mmrozek/following{/other_user}","gists_url":"https://api.github.com/users/mmrozek/gists{/gist_id}","starred_url":"https://api.github.com/users/mmrozek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmrozek/subscriptions","organizations_url":"https://api.github.com/users/mmrozek/orgs","repos_url":"https://api.github.com/users/mmrozek/repos","events_url":"https://api.github.com/users/mmrozek/events{/privacy}","received_events_url":"https://api.github.com/users/mmrozek/received_events","type":"User","site_admin":false},"body":"I changed the SendMessage to SendPacket because I want to avoid second encoding. I thought also about moving the extraction message outside the DiscoveryListener (listener don't need to know anything about message type). What do you think?","created_at":"2018-11-09T13:23:17Z","updated_at":"2018-11-13T06:09:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac0c73ab15dc5db53f245d1adae5cc179378241c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"agnikowa","id":35059616,"node_id":"MDQ6VXNlcjM1MDU5NjE2","avatar_url":"https://avatars1.githubusercontent.com/u/35059616?v=4","gravatar_id":"","url":"https://api.github.com/users/agnikowa","html_url":"https://github.com/agnikowa","followers_url":"https://api.github.com/users/agnikowa/followers","following_url":"https://api.github.com/users/agnikowa/following{/other_user}","gists_url":"https://api.github.com/users/agnikowa/gists{/gist_id}","starred_url":"https://api.github.com/users/agnikowa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agnikowa/subscriptions","organizations_url":"https://api.github.com/users/agnikowa/orgs","repos_url":"https://api.github.com/users/agnikowa/repos","events_url":"https://api.github.com/users/agnikowa/events{/privacy}","received_events_url":"https://api.github.com/users/agnikowa/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/input-output-hk/mantis/pulls/608/commits","review_comments_url":"https://api.github.com/repos/input-output-hk/mantis/pulls/608/comments","review_comment_url":"https://api.github.com/repos/input-output-hk/mantis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/input-output-hk/mantis/issues/608/comments","statuses_url":"https://api.github.com/repos/input-output-hk/mantis/statuses/ae50648d0f9c6040f44af13e8818d4147a9f7db8","head":{"label":"input-output-hk:feature/EC-596-improve-discovery","ref":"feature/EC-596-improve-discovery","sha":"ae50648d0f9c6040f44af13e8818d4147a9f7db8","user":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"repo":{"id":76256113,"node_id":"MDEwOlJlcG9zaXRvcnk3NjI1NjExMw==","name":"mantis","full_name":"input-output-hk/mantis","private":false,"owner":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/input-output-hk/mantis","description":"A Scala based client for Ethereum Classic. ","fork":false,"url":"https://api.github.com/repos/input-output-hk/mantis","forks_url":"https://api.github.com/repos/input-output-hk/mantis/forks","keys_url":"https://api.github.com/repos/input-output-hk/mantis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/input-output-hk/mantis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/input-output-hk/mantis/teams","hooks_url":"https://api.github.com/repos/input-output-hk/mantis/hooks","issue_events_url":"https://api.github.com/repos/input-output-hk/mantis/issues/events{/number}","events_url":"https://api.github.com/repos/input-output-hk/mantis/events","assignees_url":"https://api.github.com/repos/input-output-hk/mantis/assignees{/user}","branches_url":"https://api.github.com/repos/input-output-hk/mantis/branches{/branch}","tags_url":"https://api.github.com/repos/input-output-hk/mantis/tags","blobs_url":"https://api.github.com/repos/input-output-hk/mantis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/input-output-hk/mantis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/input-output-hk/mantis/git/refs{/sha}","trees_url":"https://api.github.com/repos/input-output-hk/mantis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/input-output-hk/mantis/statuses/{sha}","languages_url":"https://api.github.com/repos/input-output-hk/mantis/languages","stargazers_url":"https://api.github.com/repos/input-output-hk/mantis/stargazers","contributors_url":"https://api.github.com/repos/input-output-hk/mantis/contributors","subscribers_url":"https://api.github.com/repos/input-output-hk/mantis/subscribers","subscription_url":"https://api.github.com/repos/input-output-hk/mantis/subscription","commits_url":"https://api.github.com/repos/input-output-hk/mantis/commits{/sha}","git_commits_url":"https://api.github.com/repos/input-output-hk/mantis/git/commits{/sha}","comments_url":"https://api.github.com/repos/input-output-hk/mantis/comments{/number}","issue_comment_url":"https://api.github.com/repos/input-output-hk/mantis/issues/comments{/number}","contents_url":"https://api.github.com/repos/input-output-hk/mantis/contents/{+path}","compare_url":"https://api.github.com/repos/input-output-hk/mantis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/input-output-hk/mantis/merges","archive_url":"https://api.github.com/repos/input-output-hk/mantis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/input-output-hk/mantis/downloads","issues_url":"https://api.github.com/repos/input-output-hk/mantis/issues{/number}","pulls_url":"https://api.github.com/repos/input-output-hk/mantis/pulls{/number}","milestones_url":"https://api.github.com/repos/input-output-hk/mantis/milestones{/number}","notifications_url":"https://api.github.com/repos/input-output-hk/mantis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/input-output-hk/mantis/labels{/name}","releases_url":"https://api.github.com/repos/input-output-hk/mantis/releases{/id}","deployments_url":"https://api.github.com/repos/input-output-hk/mantis/deployments","created_at":"2016-12-12T12:51:31Z","updated_at":"2018-11-09T18:54:32Z","pushed_at":"2018-11-09T13:23:18Z","git_url":"git://github.com/input-output-hk/mantis.git","ssh_url":"git@github.com:input-output-hk/mantis.git","clone_url":"https://github.com/input-output-hk/mantis.git","svn_url":"https://github.com/input-output-hk/mantis","homepage":null,"size":16869,"stargazers_count":142,"watchers_count":142,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":47,"open_issues":30,"watchers":142,"default_branch":"master"}},"base":{"label":"input-output-hk:phase/release2_0","ref":"phase/release2_0","sha":"1fc15c79f97d6ef32b569508c9168150b897a70e","user":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"repo":{"id":76256113,"node_id":"MDEwOlJlcG9zaXRvcnk3NjI1NjExMw==","name":"mantis","full_name":"input-output-hk/mantis","private":false,"owner":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/input-output-hk/mantis","description":"A Scala based client for Ethereum Classic. ","fork":false,"url":"https://api.github.com/repos/input-output-hk/mantis","forks_url":"https://api.github.com/repos/input-output-hk/mantis/forks","keys_url":"https://api.github.com/repos/input-output-hk/mantis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/input-output-hk/mantis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/input-output-hk/mantis/teams","hooks_url":"https://api.github.com/repos/input-output-hk/mantis/hooks","issue_events_url":"https://api.github.com/repos/input-output-hk/mantis/issues/events{/number}","events_url":"https://api.github.com/repos/input-output-hk/mantis/events","assignees_url":"https://api.github.com/repos/input-output-hk/mantis/assignees{/user}","branches_url":"https://api.github.com/repos/input-output-hk/mantis/branches{/branch}","tags_url":"https://api.github.com/repos/input-output-hk/mantis/tags","blobs_url":"https://api.github.com/repos/input-output-hk/mantis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/input-output-hk/mantis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/input-output-hk/mantis/git/refs{/sha}","trees_url":"https://api.github.com/repos/input-output-hk/mantis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/input-output-hk/mantis/statuses/{sha}","languages_url":"https://api.github.com/repos/input-output-hk/mantis/languages","stargazers_url":"https://api.github.com/repos/input-output-hk/mantis/stargazers","contributors_url":"https://api.github.com/repos/input-output-hk/mantis/contributors","subscribers_url":"https://api.github.com/repos/input-output-hk/mantis/subscribers","subscription_url":"https://api.github.com/repos/input-output-hk/mantis/subscription","commits_url":"https://api.github.com/repos/input-output-hk/mantis/commits{/sha}","git_commits_url":"https://api.github.com/repos/input-output-hk/mantis/git/commits{/sha}","comments_url":"https://api.github.com/repos/input-output-hk/mantis/comments{/number}","issue_comment_url":"https://api.github.com/repos/input-output-hk/mantis/issues/comments{/number}","contents_url":"https://api.github.com/repos/input-output-hk/mantis/contents/{+path}","compare_url":"https://api.github.com/repos/input-output-hk/mantis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/input-output-hk/mantis/merges","archive_url":"https://api.github.com/repos/input-output-hk/mantis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/input-output-hk/mantis/downloads","issues_url":"https://api.github.com/repos/input-output-hk/mantis/issues{/number}","pulls_url":"https://api.github.com/repos/input-output-hk/mantis/pulls{/number}","milestones_url":"https://api.github.com/repos/input-output-hk/mantis/milestones{/number}","notifications_url":"https://api.github.com/repos/input-output-hk/mantis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/input-output-hk/mantis/labels{/name}","releases_url":"https://api.github.com/repos/input-output-hk/mantis/releases{/id}","deployments_url":"https://api.github.com/repos/input-output-hk/mantis/deployments","created_at":"2016-12-12T12:51:31Z","updated_at":"2018-11-09T18:54:32Z","pushed_at":"2018-11-09T13:23:18Z","git_url":"git://github.com/input-output-hk/mantis.git","ssh_url":"git@github.com:input-output-hk/mantis.git","clone_url":"https://github.com/input-output-hk/mantis.git","svn_url":"https://github.com/input-output-hk/mantis","homepage":null,"size":16869,"stargazers_count":142,"watchers_count":142,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":47,"open_issues":30,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/608"},"html":{"href":"https://github.com/input-output-hk/mantis/pull/608"},"issue":{"href":"https://api.github.com/repos/input-output-hk/mantis/issues/608"},"comments":{"href":"https://api.github.com/repos/input-output-hk/mantis/issues/608/comments"},"review_comments":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/608/comments"},"review_comment":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/input-output-hk/mantis/pulls/608/commits"},"statuses":{"href":"https://api.github.com/repos/input-output-hk/mantis/statuses/ae50648d0f9c6040f44af13e8818d4147a9f7db8"}},"author_association":"NONE"}}
{"actor":{"display_login":"KonradStaniec"}}