{"action":"created","issue":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1262","repository_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode","labels_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1262/labels{/name}","comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1262/comments","events_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1262/events","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/issues/1262","id":309381151,"number":1262,"title":"ConsensusLoop race condition","user":{"login":"noescape00","id":10259355,"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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-28T14:03:15Z","updated_at":"2018-04-24T12:55:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"```\r\nif (this.Tip.ChainWork > this.Chain.Tip.ChainWork)\r\n{\r\n    // This is a newly mined block.\r\n    this.Chain.SetTip(this.Tip);\r\n    this.Puller.SetLocation(this.Tip);\r\n\r\n    this.logger.LogDebug(\"Block extends best chain tip to '{0}'.\", this.Tip);\r\n}\r\n```\r\n\r\nHere after the if is evaluated to `true` it is possible that a peer sends us a better chain and we switch to it and after that inner body of the if statement is executed.\r\n\r\nAlso a race condition is possible for line 400: `this.Chain.SetTip(this.Tip);` (ask @Aprogiena about it)"},"comment":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/comments/383919833","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/issues/1262#issuecomment-383919833","issue_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/1262","id":383919833,"user":{"login":"bokobza","id":1867877,"avatar_url":"https://avatars3.githubusercontent.com/u/1867877?v=4","gravatar_id":"","url":"https://api.github.com/users/bokobza","html_url":"https://github.com/bokobza","followers_url":"https://api.github.com/users/bokobza/followers","following_url":"https://api.github.com/users/bokobza/following{/other_user}","gists_url":"https://api.github.com/users/bokobza/gists{/gist_id}","starred_url":"https://api.github.com/users/bokobza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bokobza/subscriptions","organizations_url":"https://api.github.com/users/bokobza/orgs","repos_url":"https://api.github.com/users/bokobza/repos","events_url":"https://api.github.com/users/bokobza/events{/privacy}","received_events_url":"https://api.github.com/users/bokobza/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T12:55:41Z","updated_at":"2018-04-24T12:55:41Z","author_association":"CONTRIBUTOR","body":"@Aprogiena can we close this or not yet? Or is there any other issue we should link this to?"}}
{"actor":{"display_login":"bokobza"}}