{"action":"created","comment":{"url":"https://api.github.com/repos/gcash/bchd/pulls/comments/234408365","pull_request_review_id":176053775,"id":234408365,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNDQwODM2NQ==","diff_hunk":"@@ -1665,6 +1665,82 @@ func (b *BlockChain) locateHeaders(locator BlockLocator, hashStop *chainhash.Has\n \treturn headers\n }\n \n+// ReconsiderBlock takes a block hash and allows it to be revalidated.\n+//\n+// This function is safe for concurrent access.\n+func (b *BlockChain) ReconsiderBlock(hash *chainhash.Hash) error {\n+\tb.chainLock.Lock()\n+\tdefer b.chainLock.Unlock()\n+\treturn b.reconsiderBlock(hash)\n+}\n+\n+// reconsiderBlock takes a block hash and allows it to be revalidated.\n+func (b *BlockChain) reconsiderBlock(hash *chainhash.Hash) error {\n+\tnode := b.index.LookupNode(hash)\n+\tif node == nil {\n+\t\terr := fmt.Errorf(\"block %s is not known\", hash)\n+\t\treturn err\n+\t}\n+\n+\t// No need to reconsider, it is already valid\n+\tif node.status.KnownValid() {\n+\t\treturn nil\n+\t}\n+\n+\tvar blk *bchutil.Block\n+\n+\t// Find fork point if one exists\n+\tforkNode := b.bestChain.FindFork(node)\n+\tif forkNode != nil {\n+\t\t// Roll back to the fork point and load all the nodes into a list\n+\t\tnodes := list.New()\n+\t\tfor n := node; n != nil && n != forkNode; n = n.parent {\n+\t\t\tnodes.PushFront(n)\n+\t\t}\n+\n+\t\t// Iterate over the list in reverse order so that the forkNode is processed first\n+\t\tfor e := nodes.Front(); e != nil; e = e.Next() {","path":"blockchain/chain.go","position":38,"original_position":38,"commit_id":"83b946958ac1ea6335ca76667d07065353efe866","original_commit_id":"83b946958ac1ea6335ca76667d07065353efe866","user":{"login":"cpacia","id":4504708,"node_id":"MDQ6VXNlcjQ1MDQ3MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/4504708?v=4","gravatar_id":"","url":"https://api.github.com/users/cpacia","html_url":"https://github.com/cpacia","followers_url":"https://api.github.com/users/cpacia/followers","following_url":"https://api.github.com/users/cpacia/following{/other_user}","gists_url":"https://api.github.com/users/cpacia/gists{/gist_id}","starred_url":"https://api.github.com/users/cpacia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpacia/subscriptions","organizations_url":"https://api.github.com/users/cpacia/orgs","repos_url":"https://api.github.com/users/cpacia/repos","events_url":"https://api.github.com/users/cpacia/events{/privacy}","received_events_url":"https://api.github.com/users/cpacia/received_events","type":"User","site_admin":false},"body":"Still think this needs to be iterated over this way:\r\n```\r\nvar next *list.Element\r\n\tfor e := nodes.Front(); e != nil; e = next {\r\n\t\tnext = e.Next()\r\n```\r\nYou'll note in the example if you just use e = e.Next() then e is nil on the second iteration through the loop and the loop exists. ","created_at":"2018-11-17T13:20:46Z","updated_at":"2018-11-17T13:20:50Z","html_url":"https://github.com/gcash/bchd/pull/136#discussion_r234408365","pull_request_url":"https://api.github.com/repos/gcash/bchd/pulls/136","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/gcash/bchd/pulls/comments/234408365"},"html":{"href":"https://github.com/gcash/bchd/pull/136#discussion_r234408365"},"pull_request":{"href":"https://api.github.com/repos/gcash/bchd/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/gcash/bchd/pulls/136","id":231446244,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNDQ2MjQ0","html_url":"https://github.com/gcash/bchd/pull/136","diff_url":"https://github.com/gcash/bchd/pull/136.diff","patch_url":"https://github.com/gcash/bchd/pull/136.patch","issue_url":"https://api.github.com/repos/gcash/bchd/issues/136","number":136,"state":"open","locked":false,"title":"[Feature] Add support for reconsiderblock","user":{"login":"zquestz","id":83898,"node_id":"MDQ6VXNlcjgzODk4","avatar_url":"https://avatars3.githubusercontent.com/u/83898?v=4","gravatar_id":"","url":"https://api.github.com/users/zquestz","html_url":"https://github.com/zquestz","followers_url":"https://api.github.com/users/zquestz/followers","following_url":"https://api.github.com/users/zquestz/following{/other_user}","gists_url":"https://api.github.com/users/zquestz/gists{/gist_id}","starred_url":"https://api.github.com/users/zquestz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zquestz/subscriptions","organizations_url":"https://api.github.com/users/zquestz/orgs","repos_url":"https://api.github.com/users/zquestz/repos","events_url":"https://api.github.com/users/zquestz/events{/privacy}","received_events_url":"https://api.github.com/users/zquestz/received_events","type":"User","site_admin":false},"body":"Sometimes a block gets marked as invalid that needs to be revalidated. This just adds the `reconsiderblock` rpc call just in case that happens.","created_at":"2018-11-16T08:05:38Z","updated_at":"2018-11-17T13:20:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c163141371557337a7f3d8aabf055c866bb4ce8","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tyler-smith","id":2145522,"node_id":"MDQ6VXNlcjIxNDU1MjI=","avatar_url":"https://avatars0.githubusercontent.com/u/2145522?v=4","gravatar_id":"","url":"https://api.github.com/users/tyler-smith","html_url":"https://github.com/tyler-smith","followers_url":"https://api.github.com/users/tyler-smith/followers","following_url":"https://api.github.com/users/tyler-smith/following{/other_user}","gists_url":"https://api.github.com/users/tyler-smith/gists{/gist_id}","starred_url":"https://api.github.com/users/tyler-smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyler-smith/subscriptions","organizations_url":"https://api.github.com/users/tyler-smith/orgs","repos_url":"https://api.github.com/users/tyler-smith/repos","events_url":"https://api.github.com/users/tyler-smith/events{/privacy}","received_events_url":"https://api.github.com/users/tyler-smith/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gcash/bchd/pulls/136/commits","review_comments_url":"https://api.github.com/repos/gcash/bchd/pulls/136/comments","review_comment_url":"https://api.github.com/repos/gcash/bchd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gcash/bchd/issues/136/comments","statuses_url":"https://api.github.com/repos/gcash/bchd/statuses/83b946958ac1ea6335ca76667d07065353efe866","head":{"label":"gcash:reconsider","ref":"reconsider","sha":"83b946958ac1ea6335ca76667d07065353efe866","user":{"login":"gcash","id":43224186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMjI0MTg2","avatar_url":"https://avatars2.githubusercontent.com/u/43224186?v=4","gravatar_id":"","url":"https://api.github.com/users/gcash","html_url":"https://github.com/gcash","followers_url":"https://api.github.com/users/gcash/followers","following_url":"https://api.github.com/users/gcash/following{/other_user}","gists_url":"https://api.github.com/users/gcash/gists{/gist_id}","starred_url":"https://api.github.com/users/gcash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcash/subscriptions","organizations_url":"https://api.github.com/users/gcash/orgs","repos_url":"https://api.github.com/users/gcash/repos","events_url":"https://api.github.com/users/gcash/events{/privacy}","received_events_url":"https://api.github.com/users/gcash/received_events","type":"Organization","site_admin":false},"repo":{"id":148558591,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg1NTg1OTE=","name":"bchd","full_name":"gcash/bchd","private":false,"owner":{"login":"gcash","id":43224186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMjI0MTg2","avatar_url":"https://avatars2.githubusercontent.com/u/43224186?v=4","gravatar_id":"","url":"https://api.github.com/users/gcash","html_url":"https://github.com/gcash","followers_url":"https://api.github.com/users/gcash/followers","following_url":"https://api.github.com/users/gcash/following{/other_user}","gists_url":"https://api.github.com/users/gcash/gists{/gist_id}","starred_url":"https://api.github.com/users/gcash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcash/subscriptions","organizations_url":"https://api.github.com/users/gcash/orgs","repos_url":"https://api.github.com/users/gcash/repos","events_url":"https://api.github.com/users/gcash/events{/privacy}","received_events_url":"https://api.github.com/users/gcash/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/gcash/bchd","description":"An alternative full node bitcoin cash implementation written in Go (golang) ","fork":false,"url":"https://api.github.com/repos/gcash/bchd","forks_url":"https://api.github.com/repos/gcash/bchd/forks","keys_url":"https://api.github.com/repos/gcash/bchd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gcash/bchd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gcash/bchd/teams","hooks_url":"https://api.github.com/repos/gcash/bchd/hooks","issue_events_url":"https://api.github.com/repos/gcash/bchd/issues/events{/number}","events_url":"https://api.github.com/repos/gcash/bchd/events","assignees_url":"https://api.github.com/repos/gcash/bchd/assignees{/user}","branches_url":"https://api.github.com/repos/gcash/bchd/branches{/branch}","tags_url":"https://api.github.com/repos/gcash/bchd/tags","blobs_url":"https://api.github.com/repos/gcash/bchd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gcash/bchd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gcash/bchd/git/refs{/sha}","trees_url":"https://api.github.com/repos/gcash/bchd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gcash/bchd/statuses/{sha}","languages_url":"https://api.github.com/repos/gcash/bchd/languages","stargazers_url":"https://api.github.com/repos/gcash/bchd/stargazers","contributors_url":"https://api.github.com/repos/gcash/bchd/contributors","subscribers_url":"https://api.github.com/repos/gcash/bchd/subscribers","subscription_url":"https://api.github.com/repos/gcash/bchd/subscription","commits_url":"https://api.github.com/repos/gcash/bchd/commits{/sha}","git_commits_url":"https://api.github.com/repos/gcash/bchd/git/commits{/sha}","comments_url":"https://api.github.com/repos/gcash/bchd/comments{/number}","issue_comment_url":"https://api.github.com/repos/gcash/bchd/issues/comments{/number}","contents_url":"https://api.github.com/repos/gcash/bchd/contents/{+path}","compare_url":"https://api.github.com/repos/gcash/bchd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gcash/bchd/merges","archive_url":"https://api.github.com/repos/gcash/bchd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gcash/bchd/downloads","issues_url":"https://api.github.com/repos/gcash/bchd/issues{/number}","pulls_url":"https://api.github.com/repos/gcash/bchd/pulls{/number}","milestones_url":"https://api.github.com/repos/gcash/bchd/milestones{/number}","notifications_url":"https://api.github.com/repos/gcash/bchd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gcash/bchd/labels{/name}","releases_url":"https://api.github.com/repos/gcash/bchd/releases{/id}","deployments_url":"https://api.github.com/repos/gcash/bchd/deployments","created_at":"2018-09-13T00:25:36Z","updated_at":"2018-11-17T10:48:05Z","pushed_at":"2018-11-17T10:26:11Z","git_url":"git://github.com/gcash/bchd.git","ssh_url":"git@github.com:gcash/bchd.git","clone_url":"https://github.com/gcash/bchd.git","svn_url":"https://github.com/gcash/bchd","homepage":null,"size":15721,"stargazers_count":81,"watchers_count":81,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":11,"open_issues":17,"watchers":81,"default_branch":"master"}},"base":{"label":"gcash:master","ref":"master","sha":"4ae4fdc19d270e785eda62b812c6d994c3d114a8","user":{"login":"gcash","id":43224186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMjI0MTg2","avatar_url":"https://avatars2.githubusercontent.com/u/43224186?v=4","gravatar_id":"","url":"https://api.github.com/users/gcash","html_url":"https://github.com/gcash","followers_url":"https://api.github.com/users/gcash/followers","following_url":"https://api.github.com/users/gcash/following{/other_user}","gists_url":"https://api.github.com/users/gcash/gists{/gist_id}","starred_url":"https://api.github.com/users/gcash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcash/subscriptions","organizations_url":"https://api.github.com/users/gcash/orgs","repos_url":"https://api.github.com/users/gcash/repos","events_url":"https://api.github.com/users/gcash/events{/privacy}","received_events_url":"https://api.github.com/users/gcash/received_events","type":"Organization","site_admin":false},"repo":{"id":148558591,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg1NTg1OTE=","name":"bchd","full_name":"gcash/bchd","private":false,"owner":{"login":"gcash","id":43224186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMjI0MTg2","avatar_url":"https://avatars2.githubusercontent.com/u/43224186?v=4","gravatar_id":"","url":"https://api.github.com/users/gcash","html_url":"https://github.com/gcash","followers_url":"https://api.github.com/users/gcash/followers","following_url":"https://api.github.com/users/gcash/following{/other_user}","gists_url":"https://api.github.com/users/gcash/gists{/gist_id}","starred_url":"https://api.github.com/users/gcash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcash/subscriptions","organizations_url":"https://api.github.com/users/gcash/orgs","repos_url":"https://api.github.com/users/gcash/repos","events_url":"https://api.github.com/users/gcash/events{/privacy}","received_events_url":"https://api.github.com/users/gcash/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/gcash/bchd","description":"An alternative full node bitcoin cash implementation written in Go (golang) ","fork":false,"url":"https://api.github.com/repos/gcash/bchd","forks_url":"https://api.github.com/repos/gcash/bchd/forks","keys_url":"https://api.github.com/repos/gcash/bchd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gcash/bchd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gcash/bchd/teams","hooks_url":"https://api.github.com/repos/gcash/bchd/hooks","issue_events_url":"https://api.github.com/repos/gcash/bchd/issues/events{/number}","events_url":"https://api.github.com/repos/gcash/bchd/events","assignees_url":"https://api.github.com/repos/gcash/bchd/assignees{/user}","branches_url":"https://api.github.com/repos/gcash/bchd/branches{/branch}","tags_url":"https://api.github.com/repos/gcash/bchd/tags","blobs_url":"https://api.github.com/repos/gcash/bchd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gcash/bchd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gcash/bchd/git/refs{/sha}","trees_url":"https://api.github.com/repos/gcash/bchd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gcash/bchd/statuses/{sha}","languages_url":"https://api.github.com/repos/gcash/bchd/languages","stargazers_url":"https://api.github.com/repos/gcash/bchd/stargazers","contributors_url":"https://api.github.com/repos/gcash/bchd/contributors","subscribers_url":"https://api.github.com/repos/gcash/bchd/subscribers","subscription_url":"https://api.github.com/repos/gcash/bchd/subscription","commits_url":"https://api.github.com/repos/gcash/bchd/commits{/sha}","git_commits_url":"https://api.github.com/repos/gcash/bchd/git/commits{/sha}","comments_url":"https://api.github.com/repos/gcash/bchd/comments{/number}","issue_comment_url":"https://api.github.com/repos/gcash/bchd/issues/comments{/number}","contents_url":"https://api.github.com/repos/gcash/bchd/contents/{+path}","compare_url":"https://api.github.com/repos/gcash/bchd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gcash/bchd/merges","archive_url":"https://api.github.com/repos/gcash/bchd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gcash/bchd/downloads","issues_url":"https://api.github.com/repos/gcash/bchd/issues{/number}","pulls_url":"https://api.github.com/repos/gcash/bchd/pulls{/number}","milestones_url":"https://api.github.com/repos/gcash/bchd/milestones{/number}","notifications_url":"https://api.github.com/repos/gcash/bchd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gcash/bchd/labels{/name}","releases_url":"https://api.github.com/repos/gcash/bchd/releases{/id}","deployments_url":"https://api.github.com/repos/gcash/bchd/deployments","created_at":"2018-09-13T00:25:36Z","updated_at":"2018-11-17T10:48:05Z","pushed_at":"2018-11-17T10:26:11Z","git_url":"git://github.com/gcash/bchd.git","ssh_url":"git@github.com:gcash/bchd.git","clone_url":"https://github.com/gcash/bchd.git","svn_url":"https://github.com/gcash/bchd","homepage":null,"size":15721,"stargazers_count":81,"watchers_count":81,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":11,"open_issues":17,"watchers":81,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gcash/bchd/pulls/136"},"html":{"href":"https://github.com/gcash/bchd/pull/136"},"issue":{"href":"https://api.github.com/repos/gcash/bchd/issues/136"},"comments":{"href":"https://api.github.com/repos/gcash/bchd/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/gcash/bchd/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/gcash/bchd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gcash/bchd/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/gcash/bchd/statuses/83b946958ac1ea6335ca76667d07065353efe866"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cpacia"}}