{"action":"created","comment":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments/225971349","pull_request_review_id":165683347,"id":225971349,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTk3MTM0OQ==","diff_hunk":"@@ -0,0 +1,109 @@\n+﻿using System.Linq;\n+using System.Threading.Tasks;\n+using Microsoft.Extensions.Logging;\n+using NBitcoin;\n+using Stratis.Bitcoin.Connection;\n+using Stratis.Bitcoin.Consensus;\n+using Stratis.Bitcoin.Interfaces;\n+using Stratis.Bitcoin.P2P.Peer;\n+using Stratis.Bitcoin.P2P.Protocol;\n+using Stratis.Bitcoin.P2P.Protocol.Payloads;\n+using Stratis.Bitcoin.Utilities;\n+\n+namespace Stratis.Bitcoin.Features.Consensus.Behaviors\n+{\n+   /// <summary>Behavior that takes care of proven headers protocol. It also keeps the notion of peer's consensus tip.</summary>\n+   public class ProvenHeadersConsensusManagerBehavior : ConsensusManagerBehavior\n+   {\n+      private readonly IInitialBlockDownloadState initialBlockDownloadState;\n+      private readonly IConsensusManager consensusManager;\n+      private readonly IPeerBanning peerBanning;\n+      private readonly ILoggerFactory loggerFactory;\n+      private readonly PosConsensusFactory consensusFactory;\n+\n+      /// <summary>\n+      /// The proven header peers reserved slots threshold (%).\n+      /// Represents the percentage of maximum connectable peers that we reserve for peers that are able to serve proven headers.\n+      /// </summary>\n+      private const decimal ProvenHeaderPeersReservedSlotsThreshold = 0.4M;","path":"src/Stratis.Bitcoin.Features.Consensus/Behaviors/ProvenHeadersConsensusManagerBehavior.cs","position":28,"original_position":28,"commit_id":"3bf323ef707bb99b9ec17d1da719e85db107bab7","original_commit_id":"3bf323ef707bb99b9ec17d1da719e85db107bab7","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":"redundant","created_at":"2018-10-17T15:07:16Z","updated_at":"2018-10-17T15:17:19Z","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469#discussion_r225971349","pull_request_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments/225971349"},"html":{"href":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469#discussion_r225971349"},"pull_request":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469"}}},"pull_request":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469","id":222220537,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMjIwNTM3","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469","diff_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469.diff","patch_url":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469.patch","issue_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/2469","number":2469,"state":"open","locked":false,"title":"[PH] Disconnect peers when node can't advance","user":{"login":"MithrilMan","id":5107375,"node_id":"MDQ6VXNlcjUxMDczNzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5107375?v=4","gravatar_id":"","url":"https://api.github.com/users/MithrilMan","html_url":"https://github.com/MithrilMan","followers_url":"https://api.github.com/users/MithrilMan/followers","following_url":"https://api.github.com/users/MithrilMan/following{/other_user}","gists_url":"https://api.github.com/users/MithrilMan/gists{/gist_id}","starred_url":"https://api.github.com/users/MithrilMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MithrilMan/subscriptions","organizations_url":"https://api.github.com/users/MithrilMan/orgs","repos_url":"https://api.github.com/users/MithrilMan/repos","events_url":"https://api.github.com/users/MithrilMan/events{/privacy}","received_events_url":"https://api.github.com/users/MithrilMan/received_events","type":"User","site_admin":false},"body":"implementation of #2146 \r\n\r\nEnsures we leave some available connection slots to nodes that are enabled to serve Proven Headers, if the number of minimum PH enabled nodes connected isn't met.\r\n\r\nDuring IBD, all nodes are allowed.","created_at":"2018-10-11T17:34:32Z","updated_at":"2018-10-17T15:17:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07dfb93bb8fcef4ec15d9f72ebda3fe2e2fe6518","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469/commits","review_comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469/comments","review_comment_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/2469/comments","statuses_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/statuses/3bf323ef707bb99b9ec17d1da719e85db107bab7","head":{"label":"MithrilMan:ph/disconnect-legacy-nodes","ref":"ph/disconnect-legacy-nodes","sha":"3bf323ef707bb99b9ec17d1da719e85db107bab7","user":{"login":"MithrilMan","id":5107375,"node_id":"MDQ6VXNlcjUxMDczNzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5107375?v=4","gravatar_id":"","url":"https://api.github.com/users/MithrilMan","html_url":"https://github.com/MithrilMan","followers_url":"https://api.github.com/users/MithrilMan/followers","following_url":"https://api.github.com/users/MithrilMan/following{/other_user}","gists_url":"https://api.github.com/users/MithrilMan/gists{/gist_id}","starred_url":"https://api.github.com/users/MithrilMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MithrilMan/subscriptions","organizations_url":"https://api.github.com/users/MithrilMan/orgs","repos_url":"https://api.github.com/users/MithrilMan/repos","events_url":"https://api.github.com/users/MithrilMan/events{/privacy}","received_events_url":"https://api.github.com/users/MithrilMan/received_events","type":"User","site_admin":false},"repo":{"id":82193635,"node_id":"MDEwOlJlcG9zaXRvcnk4MjE5MzYzNQ==","name":"StratisBitcoinFullNode","full_name":"MithrilMan/StratisBitcoinFullNode","private":false,"owner":{"login":"MithrilMan","id":5107375,"node_id":"MDQ6VXNlcjUxMDczNzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5107375?v=4","gravatar_id":"","url":"https://api.github.com/users/MithrilMan","html_url":"https://github.com/MithrilMan","followers_url":"https://api.github.com/users/MithrilMan/followers","following_url":"https://api.github.com/users/MithrilMan/following{/other_user}","gists_url":"https://api.github.com/users/MithrilMan/gists{/gist_id}","starred_url":"https://api.github.com/users/MithrilMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MithrilMan/subscriptions","organizations_url":"https://api.github.com/users/MithrilMan/orgs","repos_url":"https://api.github.com/users/MithrilMan/repos","events_url":"https://api.github.com/users/MithrilMan/events{/privacy}","received_events_url":"https://api.github.com/users/MithrilMan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MithrilMan/StratisBitcoinFullNode","description":null,"fork":true,"url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode","forks_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/forks","keys_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/teams","hooks_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/hooks","issue_events_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/issues/events{/number}","events_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/events","assignees_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/assignees{/user}","branches_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/branches{/branch}","tags_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/tags","blobs_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/git/refs{/sha}","trees_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/statuses/{sha}","languages_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/languages","stargazers_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/stargazers","contributors_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/contributors","subscribers_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/subscribers","subscription_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/subscription","commits_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/commits{/sha}","git_commits_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/git/commits{/sha}","comments_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/comments{/number}","issue_comment_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/issues/comments{/number}","contents_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/contents/{+path}","compare_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/merges","archive_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/downloads","issues_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/issues{/number}","pulls_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/pulls{/number}","milestones_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/milestones{/number}","notifications_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/labels{/name}","releases_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/releases{/id}","deployments_url":"https://api.github.com/repos/MithrilMan/StratisBitcoinFullNode/deployments","created_at":"2017-02-16T15:12:31Z","updated_at":"2018-10-16T18:46:20Z","pushed_at":"2018-10-16T18:46:17Z","git_url":"git://github.com/MithrilMan/StratisBitcoinFullNode.git","ssh_url":"git@github.com:MithrilMan/StratisBitcoinFullNode.git","clone_url":"https://github.com/MithrilMan/StratisBitcoinFullNode.git","svn_url":"https://github.com/MithrilMan/StratisBitcoinFullNode","homepage":null,"size":37918,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"stratisproject:master","ref":"master","sha":"452ac0760d8c3317a74cf90add35bcf60a73cb1b","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","private":false,"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},"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-10-17T15:03:17Z","pushed_at":"2018-10-17T15:03:39Z","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":34693,"stargazers_count":585,"watchers_count":585,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":256,"mirror_url":null,"archived":false,"open_issues_count":200,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":256,"open_issues":200,"watchers":585,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469"},"html":{"href":"https://github.com/stratisproject/StratisBitcoinFullNode/pull/2469"},"issue":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/2469"},"comments":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/2469/comments"},"review_comments":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469/comments"},"review_comment":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/pulls/2469/commits"},"statuses":{"href":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/statuses/3bf323ef707bb99b9ec17d1da719e85db107bab7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"noescape00"}}