GitHub PullRequestReviewCommentEvent at 2014-10-04 06:26:50
Repository: bitcoin
Actor: rebroad
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/18427897","id":18427897,"diff_hunk":"@@ -4426,9 +4480,15 @@ bool SendMessages(CNode* pto, bool fSendTrickle)\n         state.rejects.clear();\n \n         // Start block sync\n-        if (pto->fStartSync && !fImporting && !fReindex) {\n-            pto->fStartSync = false;\n-            PushGetBlocks(pto, chainActive.Tip(), uint256(0));\n+        if (pindexBestHeader == NULL)\n+            pindexBestHeader = chainActive.Tip();\n+        if (!state.fSyncStarted && !pto->fClient && !pto->fInbound && !fImporting && !fReindex) {\n+            // Only actively request headers from a single peer, unless we're close to today.\n+            if (nSyncStarted == 0 || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {\n+                state.fSyncStarted = true;\n+                nSyncStarted++;\n+                pto->PushMessage(\"getheaders\", chainActive.GetLocator(pindexBestHeader->pprev), uint256(0));","path":"src/main.cpp","position":null,"original_position":839,"commit_id":"f81de37f26a5457f3dffeee00d26403732d0c43d","original_commit_id":"2525afb58a71924d48bf99ea19cf741f0c6ccf66","user":{"login":"rebroad","id":1530283,"avatar_url":"https://avatars.githubusercontent.com/u/1530283?v=2","gravatar_id":"","url":"https://api.github.com/users/rebroad","html_url":"https://github.com/rebroad","followers_url":"https://api.github.com/users/rebroad/followers","following_url":"https://api.github.com/users/rebroad/following{/other_user}","gists_url":"https://api.github.com/users/rebroad/gists{/gist_id}","starred_url":"https://api.github.com/users/rebroad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rebroad/subscriptions","organizations_url":"https://api.github.com/users/rebroad/orgs","repos_url":"https://api.github.com/users/rebroad/repos","events_url":"https://api.github.com/users/rebroad/events{/privacy}","received_events_url":"https://api.github.com/users/rebroad/received_events","type":"User","site_admin":false},"body":"@sipa Where can I find out more about locators? I'm still not understanding the virtue of the code as it currently is, compared with sending the locator based on the same height in our chain as the height advertised by the node to which we're sending the getheaders.","created_at":"2014-10-04T06:26:50Z","updated_at":"2014-10-04T06:26:50Z","html_url":"https://github.com/bitcoin/bitcoin/pull/4468#discussion_r18427897","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/18427897"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/4468#discussion_r18427897"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468","id":18014056,"html_url":"https://github.com/bitcoin/bitcoin/pull/4468","diff_url":"https://github.com/bitcoin/bitcoin/pull/4468.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/4468.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/4468","number":4468,"state":"open","locked":false,"title":"Headers-first synchronization","user":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=2","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"body":"Here's a first (well, second) version of a fully-functional headers-first synchronization. It's not ready to be merged (it breaks reindexing, which cannot deal with out-of-order blocks on disk yet).\r\n\r\nMany changes:\r\n* Do not use 'getblocks', but 'getheaders', and use it to build a headers tree.\r\n* Blocks are fetched in parallel from all available outbound peers, using a limited moving window. When one peer stalls the movement of the window, it is disconnected.\r\n* No more orphan blocks. At all. We only ever request a block for which we have verified the headers, and store it to disk immediately. This means that a disk-fill attack would require PoW.\r\n* Some new fields in getpeerinfo:\r\n  * 'syncheight': the height up to which we've validated this peer's headers.\r\n  * 'commonheight': the height up to which we have all blocks in common with this peer.\r\n  * 'inflight': the heights we're currently requesting from this peer.\r\n* Require protocol version 31800 for every peer (released in december 2010).\r\n* No more syncnode (we sync from everyone we can, though limited to 1 during initial *headers* sync).\r\n* Introduce some extra named constants and comments.\r\n* Several bugfixes:\r\n  * CChain::GetLocator() didn't work correctly across the CChain end.\r\n  * FindMostWorkChain() failed to remove the actually failed block from setBlockIndexValid.\r\n  * ProcessMessage() failed to act on ban/reject notices resulting from validation failures during the direct execution (CheckBlock, ...).\r\n","created_at":"2014-07-05T23:09:10Z","updated_at":"2014-10-04T06:26:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c29df810acb2a9d13952a853815146a334aa3d38","assignee":null,"milestone":{"url":"https://api.github.com/repos/bitcoin/bitcoin/milestones/14","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/milestones/14/labels","id":505738,"number":14,"title":"0.10.0","description":"","creator":{"login":"laanwj","id":126646,"avatar_url":"https://avatars.githubusercontent.com/u/126646?v=2","gravatar_id":"","url":"https://api.github.com/users/laanwj","html_url":"https://github.com/laanwj","followers_url":"https://api.github.com/users/laanwj/followers","following_url":"https://api.github.com/users/laanwj/following{/other_user}","gists_url":"https://api.github.com/users/laanwj/gists{/gist_id}","starred_url":"https://api.github.com/users/laanwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laanwj/subscriptions","organizations_url":"https://api.github.com/users/laanwj/orgs","repos_url":"https://api.github.com/users/laanwj/repos","events_url":"https://api.github.com/users/laanwj/events{/privacy}","received_events_url":"https://api.github.com/users/laanwj/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":36,"state":"open","created_at":"2013-12-05T10:34:42Z","updated_at":"2014-09-08T09:10:54Z","due_on":null},"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/4468/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/f81de37f26a5457f3dffeee00d26403732d0c43d","head":{"label":"sipa:headersfirst8","ref":"headersfirst8","sha":"f81de37f26a5457f3dffeee00d26403732d0c43d","user":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=2","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"repo":{"id":1458655,"name":"bitcoin","full_name":"sipa/bitcoin","owner":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=2","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sipa/bitcoin","description":"Bitcoin integration/staging tree","fork":true,"url":"https://api.github.com/repos/sipa/bitcoin","forks_url":"https://api.github.com/repos/sipa/bitcoin/forks","keys_url":"https://api.github.com/repos/sipa/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sipa/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sipa/bitcoin/teams","hooks_url":"https://api.github.com/repos/sipa/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/sipa/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/sipa/bitcoin/events","assignees_url":"https://api.github.com/repos/sipa/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/sipa/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/sipa/bitcoin/tags","blobs_url":"https://api.github.com/repos/sipa/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sipa/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sipa/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/sipa/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sipa/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/sipa/bitcoin/languages","stargazers_url":"https://api.github.com/repos/sipa/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/sipa/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/sipa/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/sipa/bitcoin/subscription","commits_url":"https://api.github.com/repos/sipa/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/sipa/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/sipa/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/sipa/bitcoin/issues/comments/{number}","contents_url":"https://api.github.com/repos/sipa/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/sipa/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sipa/bitcoin/merges","archive_url":"https://api.github.com/repos/sipa/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sipa/bitcoin/downloads","issues_url":"https://api.github.com/repos/sipa/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/sipa/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/sipa/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/sipa/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sipa/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/sipa/bitcoin/releases{/id}","created_at":"2011-03-09T10:46:59Z","updated_at":"2014-07-27T14:54:11Z","pushed_at":"2014-10-03T17:11:13Z","git_url":"git://github.com/sipa/bitcoin.git","ssh_url":"git@github.com:sipa/bitcoin.git","clone_url":"https://github.com/sipa/bitcoin.git","svn_url":"https://github.com/sipa/bitcoin","homepage":"http://www.bitcoin.org","size":39178,"stargazers_count":25,"watchers_count":25,"language":"TypeScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":25,"default_branch":"lows"}},"base":{"label":"bitcoin:master","ref":"master","sha":"cd91ed4f5f32a3ecf907a2ab37679c41d8d1755c","user":{"login":"bitcoin","id":528860,"avatar_url":"https://avatars.githubusercontent.com/u/528860?v=2","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"repo":{"id":1181927,"name":"bitcoin","full_name":"bitcoin/bitcoin","owner":{"login":"bitcoin","id":528860,"avatar_url":"https://avatars.githubusercontent.com/u/528860?v=2","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitcoin/bitcoin","description":"Bitcoin Core integration/staging tree","fork":false,"url":"https://api.github.com/repos/bitcoin/bitcoin","forks_url":"https://api.github.com/repos/bitcoin/bitcoin/forks","keys_url":"https://api.github.com/repos/bitcoin/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitcoin/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitcoin/bitcoin/teams","hooks_url":"https://api.github.com/repos/bitcoin/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/bitcoin/bitcoin/events","assignees_url":"https://api.github.com/repos/bitcoin/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/bitcoin/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/bitcoin/bitcoin/tags","blobs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitcoin/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitcoin/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/bitcoin/bitcoin/languages","stargazers_url":"https://api.github.com/repos/bitcoin/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/bitcoin/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/bitcoin/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/bitcoin/bitcoin/subscription","commits_url":"https://api.github.com/repos/bitcoin/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitcoin/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/{number}","contents_url":"https://api.github.com/repos/bitcoin/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/bitcoin/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitcoin/bitcoin/merges","archive_url":"https://api.github.com/repos/bitcoin/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitcoin/bitcoin/downloads","issues_url":"https://api.github.com/repos/bitcoin/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/bitcoin/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/bitcoin/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/bitcoin/bitcoin/releases{/id}","created_at":"2010-12-19T15:16:43Z","updated_at":"2014-10-04T05:04:38Z","pushed_at":"2014-10-03T13:28:01Z","git_url":"git://github.com/bitcoin/bitcoin.git","ssh_url":"git@github.com:bitcoin/bitcoin.git","clone_url":"https://github.com/bitcoin/bitcoin.git","svn_url":"https://github.com/bitcoin/bitcoin","homepage":"https://bitcoin.org/en/download","size":106805,"stargazers_count":5901,"watchers_count":5901,"language":"TypeScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4247,"mirror_url":null,"open_issues_count":380,"forks":4247,"open_issues":380,"watchers":5901,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/4468"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/4468"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/4468/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/4468/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/f81de37f26a5457f3dffeee00d26403732d0c43d"}}}}