{"action":"created","comment":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments/202326561","pull_request_review_id":137006939,"id":202326561,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjMyNjU2MQ==","diff_hunk":"@@ -1966,6 +2030,122 @@ public void ChainWith10DataAvailableHeaders_PartialValidationSucceededOnTheFirst\n             listOfHeaders.Should().HaveCount(1);\n             listOfHeaders.First().ChainedHeader.HashBlock.Should().Be(secondHeader.HashBlock);\n         }\n+      \n+        /// <summary>\n+        /// Issue 19 @ New peer K claims 10d. Peer K disconnects. Chain shouldn't change.\n+        /// </summary>\n+        [Fact]\n+        public void NewPeerClaimsHeadSecondTime_PeerDisconnected_ChainShouldNotChange()\n+        {\n+            const int initialChainSize = 5;\n+            TestContext ctx = new TestContextBuilder().WithInitialChain(initialChainSize).UseCheckpoints().Build();\n+            ChainedHeaderTree cht = ctx.ChainedHeaderTree;\n+            ChainedHeader initialChainTip = ctx.InitialChainTip;\n+\n+            IEnumerable<BlockHeader> listOfAllUniqueBlockHeaders = ctx.SetupPeersForTest(initialChainSize, ctx, cht, initialChainTip, out ChainedHeader chainATip, out ChainedHeader chainDTip);\n+            CheckChainedHeaderTreeConsistency(cht, listOfAllUniqueBlockHeaders);\n+\n+            //Additional SetUp for current test\n+            ChainedHeader chainKTip = chainDTip; //peer K has exactly the same chain as peer D.\n+            List<BlockHeader> peerKBlockHeaders = ctx.ChainedHeaderToList(chainKTip, chainKTip.Height);\n+\n+            //Claiming Peer K chain\n+            ConnectNewHeadersResult connectionPeerKResult = cht.ConnectNewHeaders(5, peerKBlockHeaders);\n+            ctx.ClaimPeerChain(cht, chainKTip, connectionPeerKResult);\n+\n+            Dictionary<uint256, ChainedHeader> chainedHeadersWithPeerK = cht.GetChainedHeadersByHash();\n+\n+            cht.PeerDisconnected(5);\n+\n+            Dictionary<uint256, ChainedHeader> chainedHeadersWithoutPeerK = cht.GetChainedHeadersByHash();\n+\n+            chainedHeadersWithoutPeerK.Should().BeEquivalentTo(chainedHeadersWithPeerK);","path":"src/Stratis.Bitcoin.Tests/Consensus/ChainedHeaderTreeTest.cs","position":103,"original_position":104,"commit_id":"a80e6fb4799616eddd02454315ad9debc8b3ee66","original_commit_id":"b1de0397c28da4358c066041753f878c2512a3f6","user":{"login":"noescape00","id":10259355,"node_id":"MDQ6VXNlcjEwMjU5MzU1","avatar_url":"https://avatars0.githubusercontent.com/u/10259355?v=4","gravatar_id":"","url":"https://api.github.com/users/noescape00","html_url":"https://github.com/noescape00","followers_url":"https://api.github.com/users/noescape00/followers","following_url":"https://api.github.com/users/noescape00/following{/other_user}","gists_url":"https://api.github.com/users/noescape00/gists{/gist_id}","starred_url":"https://api.github.com/users/noescape00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noescape00/subscriptions","organizations_url":"https://api.github.com/users/noescape00/orgs","repos_url":"https://api.github.com/users/noescape00/repos","events_url":"https://api.github.com/users/noescape00/events{/privacy}","received_events_url":"https://api.github.com/users/noescape00/received_events","type":"User","site_admin":false},"body":"The method itself is not comparing the references. However `chainedHeadersWithoutPeerK` is the same dictionary as `chainedHeadersWithPeerK` so the logic is not correct. \r\nTo avoid comparing this guy against itself use \r\n`var chainedHeadersWithPeerK = new Dictionary<uint256, ChainedHeader>(cht.GetChainedHeadersByHash());`\r\n\r\ninstead of \r\n`Dictionary<uint256, ChainedHeader> chainedHeadersWithPeerK = cht.GetChainedHeadersByHash();`","created_at":"2018-07-13T11:56:57Z","updated_at":"2018-07-13T11:56:57Z","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608#discussion_r202326561","pull_request_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments/202326561"},"html":{"href":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608#discussion_r202326561"},"pull_request":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608"}},"in_reply_to_id":201273278},"pull_request":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608","id":199270878,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MjcwODc4","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608","diff_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608.diff","patch_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608.patch","issue_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1608","number":1608,"state":"open","locked":false,"title":"CHT Issue 19 & 6 Common test cases","user":{"login":"kogot","id":5482607,"node_id":"MDQ6VXNlcjU0ODI2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/5482607?v=4","gravatar_id":"","url":"https://api.github.com/users/kogot","html_url":"https://github.com/kogot","followers_url":"https://api.github.com/users/kogot/followers","following_url":"https://api.github.com/users/kogot/following{/other_user}","gists_url":"https://api.github.com/users/kogot/gists{/gist_id}","starred_url":"https://api.github.com/users/kogot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogot/subscriptions","organizations_url":"https://api.github.com/users/kogot/orgs","repos_url":"https://api.github.com/users/kogot/repos","events_url":"https://api.github.com/users/kogot/events{/privacy}","received_events_url":"https://api.github.com/users/kogot/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-04T14:47:11Z","updated_at":"2018-07-13T11:56:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a07c352fe7c9100262864300e1c654e0ada50cf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":926801084,"node_id":"MDU6TGFiZWw5MjY4MDEwODQ=","url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/labels/pr-review-low","name":"pr-review-low","color":"68A7F3","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608/commits","review_comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608/comments","review_comment_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1608/comments","statuses_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/statuses/a80e6fb4799616eddd02454315ad9debc8b3ee66","head":{"label":"kogot:cht-test","ref":"cht-test","sha":"a80e6fb4799616eddd02454315ad9debc8b3ee66","user":{"login":"kogot","id":5482607,"node_id":"MDQ6VXNlcjU0ODI2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/5482607?v=4","gravatar_id":"","url":"https://api.github.com/users/kogot","html_url":"https://github.com/kogot","followers_url":"https://api.github.com/users/kogot/followers","following_url":"https://api.github.com/users/kogot/following{/other_user}","gists_url":"https://api.github.com/users/kogot/gists{/gist_id}","starred_url":"https://api.github.com/users/kogot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogot/subscriptions","organizations_url":"https://api.github.com/users/kogot/orgs","repos_url":"https://api.github.com/users/kogot/repos","events_url":"https://api.github.com/users/kogot/events{/privacy}","received_events_url":"https://api.github.com/users/kogot/received_events","type":"User","site_admin":false},"repo":{"id":119508425,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk1MDg0MjU=","name":"StratisBitcoinFullNode","full_name":"kogot/StratisBitcoinFullNode","owner":{"login":"kogot","id":5482607,"node_id":"MDQ6VXNlcjU0ODI2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/5482607?v=4","gravatar_id":"","url":"https://api.github.com/users/kogot","html_url":"https://github.com/kogot","followers_url":"https://api.github.com/users/kogot/followers","following_url":"https://api.github.com/users/kogot/following{/other_user}","gists_url":"https://api.github.com/users/kogot/gists{/gist_id}","starred_url":"https://api.github.com/users/kogot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogot/subscriptions","organizations_url":"https://api.github.com/users/kogot/orgs","repos_url":"https://api.github.com/users/kogot/repos","events_url":"https://api.github.com/users/kogot/events{/privacy}","received_events_url":"https://api.github.com/users/kogot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kogot/StratisBitcoinFullNode","description":"Bitcoin full node in C#","fork":true,"url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode","forks_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/forks","keys_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/teams","hooks_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/hooks","issue_events_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/issues/events{/number}","events_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/events","assignees_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/assignees{/user}","branches_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/branches{/branch}","tags_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/tags","blobs_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/git/refs{/sha}","trees_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/statuses/{sha}","languages_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/languages","stargazers_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/stargazers","contributors_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/contributors","subscribers_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/subscribers","subscription_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/subscription","commits_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/commits{/sha}","git_commits_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/git/commits{/sha}","comments_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/comments{/number}","issue_comment_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/issues/comments{/number}","contents_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/contents/{+path}","compare_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/merges","archive_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/downloads","issues_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/issues{/number}","pulls_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/pulls{/number}","milestones_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/milestones{/number}","notifications_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/labels{/name}","releases_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/releases{/id}","deployments_url":"https://api.github.com/repos/kogot/StratisBitcoinFullNode/deployments","created_at":"2018-01-30T08:49:38Z","updated_at":"2018-05-10T11:40:58Z","pushed_at":"2018-07-12T12:04:56Z","git_url":"git://github.com/kogot/StratisBitcoinFullNode.git","ssh_url":"git@github.com:kogot/StratisBitcoinFullNode.git","clone_url":"https://github.com/kogot/StratisBitcoinFullNode.git","svn_url":"https://github.com/kogot/StratisBitcoinFullNode","homepage":"https://stratisplatform.com","size":33805,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stratisproject:master","ref":"master","sha":"831a43232f3e7f2e19a408986c8004ca46c31c5f","user":{"login":"stratisproject","id":15229748,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MjI5NzQ4","avatar_url":"https://avatars0.githubusercontent.com/u/15229748?v=4","gravatar_id":"","url":"https://api.github.com/users/stratisproject","html_url":"https://github.com/stratisproject","followers_url":"https://api.github.com/users/stratisproject/followers","following_url":"https://api.github.com/users/stratisproject/following{/other_user}","gists_url":"https://api.github.com/users/stratisproject/gists{/gist_id}","starred_url":"https://api.github.com/users/stratisproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratisproject/subscriptions","organizations_url":"https://api.github.com/users/stratisproject/orgs","repos_url":"https://api.github.com/users/stratisproject/repos","events_url":"https://api.github.com/users/stratisproject/events{/privacy}","received_events_url":"https://api.github.com/users/stratisproject/received_events","type":"Organization","site_admin":false},"repo":{"id":67271290,"node_id":"MDEwOlJlcG9zaXRvcnk2NzI3MTI5MA==","name":"StratisBitcoinFullNode","full_name":"stratisproject/StratisBitcoinFullNode","owner":{"login":"stratisproject","id":15229748,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MjI5NzQ4","avatar_url":"https://avatars0.githubusercontent.com/u/15229748?v=4","gravatar_id":"","url":"https://api.github.com/users/stratisproject","html_url":"https://github.com/stratisproject","followers_url":"https://api.github.com/users/stratisproject/followers","following_url":"https://api.github.com/users/stratisproject/following{/other_user}","gists_url":"https://api.github.com/users/stratisproject/gists{/gist_id}","starred_url":"https://api.github.com/users/stratisproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratisproject/subscriptions","organizations_url":"https://api.github.com/users/stratisproject/orgs","repos_url":"https://api.github.com/users/stratisproject/repos","events_url":"https://api.github.com/users/stratisproject/events{/privacy}","received_events_url":"https://api.github.com/users/stratisproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stratisproject/StratisBitcoinFullNode","description":"Bitcoin full node in C#","fork":false,"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode","forks_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/forks","keys_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/teams","hooks_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/hooks","issue_events_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/events{/number}","events_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/events","assignees_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/assignees{/user}","branches_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/branches{/branch}","tags_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/tags","blobs_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/git/refs{/sha}","trees_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/statuses/{sha}","languages_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/languages","stargazers_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/stargazers","contributors_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/contributors","subscribers_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/subscribers","subscription_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/subscription","commits_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/commits{/sha}","git_commits_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/git/commits{/sha}","comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/comments{/number}","issue_comment_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/comments{/number}","contents_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/contents/{+path}","compare_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/merges","archive_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/downloads","issues_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues{/number}","pulls_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls{/number}","milestones_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/milestones{/number}","notifications_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/labels{/name}","releases_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/releases{/id}","deployments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/deployments","created_at":"2016-09-03T04:32:51Z","updated_at":"2018-07-13T06:05:05Z","pushed_at":"2018-07-13T11:26:30Z","git_url":"git://github.com/stratisproject/StratisBitcoinFullNode.git","ssh_url":"git@github.com:stratisproject/StratisBitcoinFullNode.git","clone_url":"https://github.com/stratisproject/StratisBitcoinFullNode.git","svn_url":"https://github.com/stratisproject/StratisBitcoinFullNode","homepage":"https://stratisplatform.com","size":31317,"stargazers_count":507,"watchers_count":507,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":228,"mirror_url":null,"archived":false,"open_issues_count":109,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":228,"open_issues":109,"watchers":507,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608"},"html":{"href":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/1608"},"issue":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1608"},"comments":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1608/comments"},"review_comments":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608/comments"},"review_comment":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/1608/commits"},"statuses":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/statuses/a80e6fb4799616eddd02454315ad9debc8b3ee66"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"noescape00"}}