{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/245067656","pull_request_review_id":189099837,"id":245067656,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NTA2NzY1Ng==","diff_hunk":"@@ -58,10 +58,7 @@ static CUpdatedBlock latestblock;\n  */\n double GetDifficulty(const CBlockIndex* blockindex)\n {\n-    if (blockindex == nullptr)\n-    {\n-        return 1.0;\n-    }\n+    assert(blockindex);","path":"src/rpc/blockchain.cpp","position":8,"original_position":8,"commit_id":"b9f226b41f989f5c07fe57801701a39c14a6e173","original_commit_id":"343b98cbcd52854ffffaca7ada72f5522117ac7f","user":{"login":"promag","id":3534524,"node_id":"MDQ6VXNlcjM1MzQ1MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3534524?v=4","gravatar_id":"","url":"https://api.github.com/users/promag","html_url":"https://github.com/promag","followers_url":"https://api.github.com/users/promag/followers","following_url":"https://api.github.com/users/promag/following{/other_user}","gists_url":"https://api.github.com/users/promag/gists{/gist_id}","starred_url":"https://api.github.com/users/promag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promag/subscriptions","organizations_url":"https://api.github.com/users/promag/orgs","repos_url":"https://api.github.com/users/promag/repos","events_url":"https://api.github.com/users/promag/events{/privacy}","received_events_url":"https://api.github.com/users/promag/received_events","type":"User","site_admin":false},"body":"I don't think this is a usage error, should be a programatic error?","created_at":"2019-01-03T17:06:51Z","updated_at":"2019-01-03T17:06:52Z","html_url":"https://github.com/bitcoin/bitcoin/pull/12151#discussion_r245067656","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/245067656"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/12151#discussion_r245067656"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151"}},"in_reply_to_id":217853810},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151","id":162380342,"node_id":"MDExOlB1bGxSZXF1ZXN0MTYyMzgwMzQy","html_url":"https://github.com/bitcoin/bitcoin/pull/12151","diff_url":"https://github.com/bitcoin/bitcoin/pull/12151.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/12151.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12151","number":12151,"state":"open","locked":false,"title":"rpc: Remove cs_main lock from blockToJSON and blockheaderToJSON","user":{"login":"promag","id":3534524,"node_id":"MDQ6VXNlcjM1MzQ1MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3534524?v=4","gravatar_id":"","url":"https://api.github.com/users/promag","html_url":"https://github.com/promag","followers_url":"https://api.github.com/users/promag/followers","following_url":"https://api.github.com/users/promag/following{/other_user}","gists_url":"https://api.github.com/users/promag/gists{/gist_id}","starred_url":"https://api.github.com/users/promag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promag/subscriptions","organizations_url":"https://api.github.com/users/promag/orgs","repos_url":"https://api.github.com/users/promag/repos","events_url":"https://api.github.com/users/promag/events{/privacy}","received_events_url":"https://api.github.com/users/promag/received_events","type":"User","site_admin":false},"body":"Motivated by https://github.com/bitcoin/bitcoin/pull/11913#discussion_r157798157, this pull makes `blockToJSON` and `blockheaderToJSON` free of `cs_main` locks.\r\n\r\nLocking `cs_main` was required to access `chainActive` in order to check if the block was in the chain and to retrieve the next block index.\r\n\r\nWith the this approach, `CBlockIndex::GetAncestor()` is used in a way to check if the block belongs to the specified chain tip and, at the same time, get the next block index.","created_at":"2018-01-11T13:19:03Z","updated_at":"2019-01-03T17:06:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5562d3403696e36656ae44fabaa106aea2e4c34","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":98279177,"node_id":"MDU6TGFiZWw5ODI3OTE3Nw==","url":"https://api.github.com/repos/bitcoin/bitcoin/labels/RPC/REST/ZMQ","name":"RPC/REST/ZMQ","color":"0052cc","default":false},{"id":135961,"node_id":"MDU6TGFiZWwxMzU5NjE=","url":"https://api.github.com/repos/bitcoin/bitcoin/labels/Refactoring","name":"Refactoring","color":"E6F6D6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12151/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/b9f226b41f989f5c07fe57801701a39c14a6e173","head":{"label":"promag:2018-01-blocktojson","ref":"2018-01-blocktojson","sha":"b9f226b41f989f5c07fe57801701a39c14a6e173","user":{"login":"promag","id":3534524,"node_id":"MDQ6VXNlcjM1MzQ1MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3534524?v=4","gravatar_id":"","url":"https://api.github.com/users/promag","html_url":"https://github.com/promag","followers_url":"https://api.github.com/users/promag/followers","following_url":"https://api.github.com/users/promag/following{/other_user}","gists_url":"https://api.github.com/users/promag/gists{/gist_id}","starred_url":"https://api.github.com/users/promag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promag/subscriptions","organizations_url":"https://api.github.com/users/promag/orgs","repos_url":"https://api.github.com/users/promag/repos","events_url":"https://api.github.com/users/promag/events{/privacy}","received_events_url":"https://api.github.com/users/promag/received_events","type":"User","site_admin":false},"repo":{"id":95606613,"node_id":"MDEwOlJlcG9zaXRvcnk5NTYwNjYxMw==","name":"bitcoin","full_name":"promag/bitcoin","private":false,"owner":{"login":"promag","id":3534524,"node_id":"MDQ6VXNlcjM1MzQ1MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3534524?v=4","gravatar_id":"","url":"https://api.github.com/users/promag","html_url":"https://github.com/promag","followers_url":"https://api.github.com/users/promag/followers","following_url":"https://api.github.com/users/promag/following{/other_user}","gists_url":"https://api.github.com/users/promag/gists{/gist_id}","starred_url":"https://api.github.com/users/promag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promag/subscriptions","organizations_url":"https://api.github.com/users/promag/orgs","repos_url":"https://api.github.com/users/promag/repos","events_url":"https://api.github.com/users/promag/events{/privacy}","received_events_url":"https://api.github.com/users/promag/received_events","type":"User","site_admin":false},"html_url":"https://github.com/promag/bitcoin","description":"Bitcoin Core integration/staging tree","fork":true,"url":"https://api.github.com/repos/promag/bitcoin","forks_url":"https://api.github.com/repos/promag/bitcoin/forks","keys_url":"https://api.github.com/repos/promag/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/promag/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/promag/bitcoin/teams","hooks_url":"https://api.github.com/repos/promag/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/promag/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/promag/bitcoin/events","assignees_url":"https://api.github.com/repos/promag/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/promag/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/promag/bitcoin/tags","blobs_url":"https://api.github.com/repos/promag/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/promag/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/promag/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/promag/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/promag/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/promag/bitcoin/languages","stargazers_url":"https://api.github.com/repos/promag/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/promag/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/promag/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/promag/bitcoin/subscription","commits_url":"https://api.github.com/repos/promag/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/promag/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/promag/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/promag/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/promag/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/promag/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/promag/bitcoin/merges","archive_url":"https://api.github.com/repos/promag/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/promag/bitcoin/downloads","issues_url":"https://api.github.com/repos/promag/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/promag/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/promag/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/promag/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/promag/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/promag/bitcoin/releases{/id}","deployments_url":"https://api.github.com/repos/promag/bitcoin/deployments","created_at":"2017-06-27T22:37:11Z","updated_at":"2018-08-21T18:59:21Z","pushed_at":"2019-01-02T15:11:29Z","git_url":"git://github.com/promag/bitcoin.git","ssh_url":"git@github.com:promag/bitcoin.git","clone_url":"https://github.com/promag/bitcoin.git","svn_url":"https://github.com/promag/bitcoin","homepage":"https://bitcoin.org/en/download","size":113010,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"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":"bitcoin:master","ref":"master","sha":"cb25cd6aa18c69918176d68e36e26f7e373aa48c","user":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgxOTI3","name":"bitcoin","full_name":"bitcoin/bitcoin","private":false,"owner":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","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},"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}","deployments_url":"https://api.github.com/repos/bitcoin/bitcoin/deployments","created_at":"2010-12-19T15:16:43Z","updated_at":"2019-01-03T16:45:59Z","pushed_at":"2019-01-03T16:01:17Z","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://bitcoincore.org/en/download","size":116391,"stargazers_count":36603,"watchers_count":36603,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":21833,"mirror_url":null,"archived":false,"open_issues_count":882,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":21833,"open_issues":882,"watchers":36603,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/12151"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/12151"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/12151/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12151/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/b9f226b41f989f5c07fe57801701a39c14a6e173"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"promag"}}