{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/37206594","id":37206594,"diff_hunk":"@@ -357,42 +336,201 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {\n \t\t\tpm.downloader.DeliverBlocks(p.id, blocks)\n \t\t}\n \n-\tcase NewBlockHashesMsg:\n-\t\t// Retrieve and deseralize the remote new block hashes notification\n+\t// Block header query, collect the requested headers and reply\n+\tcase p.version >= eth62 && msg.Code == GetBlockHeadersMsg:\n+\t\t// Decode the complex header query\n+\t\tvar query getBlockHeadersData\n+\t\tif err := msg.Decode(&query); err != nil {\n+\t\t\treturn errResp(ErrDecode, \"%v: %v\", msg, err)\n+\t\t}\n+\t\t// Gather blocks until the fetch or network limits is reached\n+\t\tvar (\n+\t\t\tbytes   common.StorageSize\n+\t\t\theaders []*types.Header\n+\t\t\tunknown bool\n+\t\t)\n+\t\tfor !unknown && len(headers) < int(query.Amount) && bytes < softResponseLimit && len(headers) < downloader.MaxHeaderFetch {\n+\t\t\t// Retrieve the next block satisfying the query\n+\t\t\tvar origin *types.Block\n+\t\t\tif query.Origin.Hash != (common.Hash{}) {\n+\t\t\t\torigin = pm.chainman.GetBlock(query.Origin.Hash)\n+\t\t\t} else {\n+\t\t\t\torigin = pm.chainman.GetBlockByNumber(query.Origin.Number)\n+\t\t\t}\n+\t\t\tif origin == nil {\n+\t\t\t\tbreak\n+\t\t\t}\n+\t\t\theaders = append(headers, origin.Header())\n+\t\t\tbytes += origin.Size()\n+\n+\t\t\t// Advance to the next block of the query","path":"eth/handler.go","position":214,"original_position":214,"commit_id":"738b34e7eac0bc1888215b8e83218aed27f781b5","original_commit_id":"738b34e7eac0bc1888215b8e83218aed27f781b5","user":{"login":"Gustav-Simonsson","id":293096,"avatar_url":"https://avatars.githubusercontent.com/u/293096?v=3","gravatar_id":"","url":"https://api.github.com/users/Gustav-Simonsson","html_url":"https://github.com/Gustav-Simonsson","followers_url":"https://api.github.com/users/Gustav-Simonsson/followers","following_url":"https://api.github.com/users/Gustav-Simonsson/following{/other_user}","gists_url":"https://api.github.com/users/Gustav-Simonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/Gustav-Simonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gustav-Simonsson/subscriptions","organizations_url":"https://api.github.com/users/Gustav-Simonsson/orgs","repos_url":"https://api.github.com/users/Gustav-Simonsson/repos","events_url":"https://api.github.com/users/Gustav-Simonsson/events{/privacy}","received_events_url":"https://api.github.com/users/Gustav-Simonsson/received_events","type":"User","site_admin":false},"body":"Why is both hash and block number supported for block traversal?","created_at":"2015-08-17T16:28:57Z","updated_at":"2015-08-17T16:28:57Z","html_url":"https://github.com/ethereum/go-ethereum/pull/1380#discussion_r37206594","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/37206594"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1380#discussion_r37206594"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380","id":39071938,"html_url":"https://github.com/ethereum/go-ethereum/pull/1380","diff_url":"https://github.com/ethereum/go-ethereum/pull/1380.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/1380.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1380","number":1380,"state":"open","locked":false,"title":"Implement server side packet handling for eth/62 and eth/63","user":{"login":"karalabe","id":129561,"avatar_url":"https://avatars.githubusercontent.com/u/129561?v=3","gravatar_id":"","url":"https://api.github.com/users/karalabe","html_url":"https://github.com/karalabe","followers_url":"https://api.github.com/users/karalabe/followers","following_url":"https://api.github.com/users/karalabe/following{/other_user}","gists_url":"https://api.github.com/users/karalabe/gists{/gist_id}","starred_url":"https://api.github.com/users/karalabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karalabe/subscriptions","organizations_url":"https://api.github.com/users/karalabe/orgs","repos_url":"https://api.github.com/users/karalabe/repos","events_url":"https://api.github.com/users/karalabe/events{/privacy}","received_events_url":"https://api.github.com/users/karalabe/received_events","type":"User","site_admin":false},"body":"This PR aims to implement the \"server\" side of the [eth/62](https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol#proposed-messages-for-new-model-syncing-pv62) and [eth/63](https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol#proposed-messages-for-light-client-pv63) protocols. The goal of v62 is to introduce the necessary network packets for more flexible full node synchronization, whereas v63 aims to set the bases for implementing light clients. All the proposed network packets have been implemented and handled, also supporting switching the between any of the 4 currently supported protocol versions: 60 through 63.\r\n\r\nNote, the client side of the protocols (i.e. synchronization, downloader, fetcher, etc), have **not** yet been updated, so enabling protocols above 62 and connecting to the main net would likely result in very undefined behavior.\r\n\r\nHowever, given the scope of this PR, I would like to have a round of reviews and corrections in the current state, and only move forward with implementing the client side and updated/new sync logic after the server side core is deemed to be solid. That should desirable be done in a new PR to keep the merges clean.","created_at":"2015-07-02T11:15:44Z","updated_at":"2015-08-17T16:28:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6dc8f3f5963895c6399fe21e7956f4a02b4202d","assignee":null,"milestone":{"url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/16","html_url":"https://github.com/ethereum/go-ethereum/milestones/1.0.3","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/16/labels","id":1256572,"number":16,"title":"1.0.3","description":"","creator":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":0,"state":"open","created_at":"2015-08-15T21:52:41Z","updated_at":"2015-08-17T09:25:16Z","due_on":"2015-09-13T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380/comments","review_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1380/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/738b34e7eac0bc1888215b8e83218aed27f781b5","head":{"label":"karalabe:eth62","ref":"eth62","sha":"738b34e7eac0bc1888215b8e83218aed27f781b5","user":{"login":"karalabe","id":129561,"avatar_url":"https://avatars.githubusercontent.com/u/129561?v=3","gravatar_id":"","url":"https://api.github.com/users/karalabe","html_url":"https://github.com/karalabe","followers_url":"https://api.github.com/users/karalabe/followers","following_url":"https://api.github.com/users/karalabe/following{/other_user}","gists_url":"https://api.github.com/users/karalabe/gists{/gist_id}","starred_url":"https://api.github.com/users/karalabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karalabe/subscriptions","organizations_url":"https://api.github.com/users/karalabe/orgs","repos_url":"https://api.github.com/users/karalabe/repos","events_url":"https://api.github.com/users/karalabe/events{/privacy}","received_events_url":"https://api.github.com/users/karalabe/received_events","type":"User","site_admin":false},"repo":{"id":33668567,"name":"go-ethereum","full_name":"karalabe/go-ethereum","owner":{"login":"karalabe","id":129561,"avatar_url":"https://avatars.githubusercontent.com/u/129561?v=3","gravatar_id":"","url":"https://api.github.com/users/karalabe","html_url":"https://github.com/karalabe","followers_url":"https://api.github.com/users/karalabe/followers","following_url":"https://api.github.com/users/karalabe/following{/other_user}","gists_url":"https://api.github.com/users/karalabe/gists{/gist_id}","starred_url":"https://api.github.com/users/karalabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karalabe/subscriptions","organizations_url":"https://api.github.com/users/karalabe/orgs","repos_url":"https://api.github.com/users/karalabe/repos","events_url":"https://api.github.com/users/karalabe/events{/privacy}","received_events_url":"https://api.github.com/users/karalabe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/karalabe/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":true,"url":"https://api.github.com/repos/karalabe/go-ethereum","forks_url":"https://api.github.com/repos/karalabe/go-ethereum/forks","keys_url":"https://api.github.com/repos/karalabe/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karalabe/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karalabe/go-ethereum/teams","hooks_url":"https://api.github.com/repos/karalabe/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/karalabe/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/karalabe/go-ethereum/events","assignees_url":"https://api.github.com/repos/karalabe/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/karalabe/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/karalabe/go-ethereum/tags","blobs_url":"https://api.github.com/repos/karalabe/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karalabe/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karalabe/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/karalabe/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karalabe/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/karalabe/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/karalabe/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/karalabe/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/karalabe/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/karalabe/go-ethereum/subscription","commits_url":"https://api.github.com/repos/karalabe/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/karalabe/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/karalabe/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/karalabe/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/karalabe/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/karalabe/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karalabe/go-ethereum/merges","archive_url":"https://api.github.com/repos/karalabe/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karalabe/go-ethereum/downloads","issues_url":"https://api.github.com/repos/karalabe/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/karalabe/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/karalabe/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/karalabe/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karalabe/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/karalabe/go-ethereum/releases{/id}","created_at":"2015-04-09T12:51:45Z","updated_at":"2015-04-17T13:40:48Z","pushed_at":"2015-08-17T11:05:08Z","git_url":"git://github.com/karalabe/go-ethereum.git","ssh_url":"git@github.com:karalabe/go-ethereum.git","clone_url":"https://github.com/karalabe/go-ethereum.git","svn_url":"https://github.com/karalabe/go-ethereum","homepage":"","size":48158,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"cd81356acef707e077622791a88864a221fa13be","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":15452919,"name":"go-ethereum","full_name":"ethereum/go-ethereum","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":false,"url":"https://api.github.com/repos/ethereum/go-ethereum","forks_url":"https://api.github.com/repos/ethereum/go-ethereum/forks","keys_url":"https://api.github.com/repos/ethereum/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/go-ethereum/teams","hooks_url":"https://api.github.com/repos/ethereum/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/go-ethereum/events","assignees_url":"https://api.github.com/repos/ethereum/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/go-ethereum/tags","blobs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/ethereum/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/ethereum/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/ethereum/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/ethereum/go-ethereum/subscription","commits_url":"https://api.github.com/repos/ethereum/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/go-ethereum/merges","archive_url":"https://api.github.com/repos/ethereum/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/go-ethereum/downloads","issues_url":"https://api.github.com/repos/ethereum/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/go-ethereum/releases{/id}","created_at":"2013-12-26T13:05:46Z","updated_at":"2015-08-16T11:49:15Z","pushed_at":"2015-08-17T13:37:58Z","git_url":"git://github.com/ethereum/go-ethereum.git","ssh_url":"git@github.com:ethereum/go-ethereum.git","clone_url":"https://github.com/ethereum/go-ethereum.git","svn_url":"https://github.com/ethereum/go-ethereum","homepage":"","size":75621,"stargazers_count":589,"watchers_count":589,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":189,"mirror_url":null,"open_issues_count":157,"forks":189,"open_issues":157,"watchers":589,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1380"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1380"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1380/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1380/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/738b34e7eac0bc1888215b8e83218aed27f781b5"}}}}