{"action":"created","comment":{"url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments/183574170","pull_request_review_id":114598029,"id":183574170,"diff_hunk":"@@ -1549,8 +1599,9 @@ type ChannelCloseSummary struct {\n \t// outstanding outgoing HTLC's at the time of channel closure.\n \tTimeLockedBalance btcutil.Amount\n \n-\t// CloseType details exactly _how_ the channel was closed. Three\n-\t// closure types are possible: cooperative, force, and breach.\n+\t// CloseType details exactly _how_ the channel was closed. Four closure\n+\t// types are possible: cooperative, local force, remote force, and\n+\t// breach.","path":"channeldb/channel.go","position":144,"original_position":144,"commit_id":"9e274995966c1864e0fec02f2cd11469f36b79a7","original_commit_id":"f69bf6f2923c239945dc4133587fd875c52791e1","user":{"login":"Roasbeef","id":998190,"avatar_url":"https://avatars3.githubusercontent.com/u/998190?v=4","gravatar_id":"","url":"https://api.github.com/users/Roasbeef","html_url":"https://github.com/Roasbeef","followers_url":"https://api.github.com/users/Roasbeef/followers","following_url":"https://api.github.com/users/Roasbeef/following{/other_user}","gists_url":"https://api.github.com/users/Roasbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/Roasbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roasbeef/subscriptions","organizations_url":"https://api.github.com/users/Roasbeef/orgs","repos_url":"https://api.github.com/users/Roasbeef/repos","events_url":"https://api.github.com/users/Roasbeef/events{/privacy}","received_events_url":"https://api.github.com/users/Roasbeef/received_events","type":"User","site_admin":false},"body":"Was it removed in this diff? Didn't pick up...or are we talking about merging some of the other ones? ","created_at":"2018-04-24T00:17:33Z","updated_at":"2018-04-24T00:17:33Z","html_url":"https://github.com/lightningnetwork/lnd/pull/1017#discussion_r183574170","pull_request_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments/183574170"},"html":{"href":"https://github.com/lightningnetwork/lnd/pull/1017#discussion_r183574170"},"pull_request":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017"}},"in_reply_to_id":183156218},"pull_request":{"url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017","id":179204218,"html_url":"https://github.com/lightningnetwork/lnd/pull/1017","diff_url":"https://github.com/lightningnetwork/lnd/pull/1017.diff","patch_url":"https://github.com/lightningnetwork/lnd/pull/1017.patch","issue_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/1017","number":1017,"state":"open","locked":false,"title":"Contract court acting on confirmed chain events","user":{"login":"halseth","id":3765732,"avatar_url":"https://avatars1.githubusercontent.com/u/3765732?v=4","gravatar_id":"","url":"https://api.github.com/users/halseth","html_url":"https://github.com/halseth","followers_url":"https://api.github.com/users/halseth/followers","following_url":"https://api.github.com/users/halseth/following{/other_user}","gists_url":"https://api.github.com/users/halseth/gists{/gist_id}","starred_url":"https://api.github.com/users/halseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halseth/subscriptions","organizations_url":"https://api.github.com/users/halseth/orgs","repos_url":"https://api.github.com/users/halseth/repos","events_url":"https://api.github.com/users/halseth/events{/privacy}","received_events_url":"https://api.github.com/users/halseth/received_events","type":"User","site_admin":false},"body":"This PR changes the way the `ChannelArbitrator` state machine is triggered, by making the `ChainEvents` sent from the `ChainWatcher` only being sent if a commitment is confirmed on-chain. This is done to ensure that if we act on a commitment (force close, breach, cooperative close etc), then the commitment we act on will not be replaced by another, valid commitment in-chain.\r\n\r\n### ChannelArbitrator\r\nThe `ChannelArbitrator`'s state machine is changed to accept any commitment being seen on-chain, regardless what state it is currently in. In particular, we would previously assume a local force close transaction always would be confirmed if we had successfully broadcasted it. Now we broadcast, and wait for any commitment to be accepted into a block before making any more assumptions.\r\n\r\n### OpenChannel\r\nBy having to wait for a commitment to appear in-chain before taking any further action, a new \"pending close state\" a channel can be in is introduced. We add a field `BroadcastedCommitment` to the `OpenChannel` struct, which keeps track of the intermediate state a channel can be in if the commitment has been broadcasted. This field is needed to make sure we don't try to forward payments over such a channel, as it might be our commitment that is broadcasted.\r\n\r\n### ChainWatcher\r\nThe `ChainWatcher` now only dispatches confirmed events, making all it's clients unaware of any unconfirmed spends.\r\n\r\nFixes #538 \r\nFixes #880\r\nFixes #1112 \r\nFixes #1071 \r\nFixes #1091\r\n\r\n**Note:** builds on top of #956 and #969, and the integration tests need https://github.com/Roasbeef/btcd/pull/20 to avoid flakes.\r\n\r\nTODO before merge:\r\n- [ ] Finish unit tests for the ChannelArbitrator\r\n- [ ] ~~Database migration logic~~\r\n- [x] Update dependencies if/when https://github.com/Roasbeef/btcd/pull/20 is merged","created_at":"2018-04-03T20:00:50Z","updated_at":"2018-04-24T00:17:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad78c25a6430641b1114b2afae641c382217d8a6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":465888460,"url":"https://api.github.com/repos/lightningnetwork/lnd/labels/commitments","name":"commitments","color":"d93f0b","default":false},{"id":487071754,"url":"https://api.github.com/repos/lightningnetwork/lnd/labels/notifications","name":"notifications","color":"bfdadc","default":false},{"id":431221720,"url":"https://api.github.com/repos/lightningnetwork/lnd/labels/state%20machine","name":"state machine","color":"d93f0b","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017/commits","review_comments_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017/comments","review_comment_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/1017/comments","statuses_url":"https://api.github.com/repos/lightningnetwork/lnd/statuses/9e274995966c1864e0fec02f2cd11469f36b79a7","head":{"label":"halseth:contract-court-without-on-chain","ref":"contract-court-without-on-chain","sha":"9e274995966c1864e0fec02f2cd11469f36b79a7","user":{"login":"halseth","id":3765732,"avatar_url":"https://avatars1.githubusercontent.com/u/3765732?v=4","gravatar_id":"","url":"https://api.github.com/users/halseth","html_url":"https://github.com/halseth","followers_url":"https://api.github.com/users/halseth/followers","following_url":"https://api.github.com/users/halseth/following{/other_user}","gists_url":"https://api.github.com/users/halseth/gists{/gist_id}","starred_url":"https://api.github.com/users/halseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halseth/subscriptions","organizations_url":"https://api.github.com/users/halseth/orgs","repos_url":"https://api.github.com/users/halseth/repos","events_url":"https://api.github.com/users/halseth/events{/privacy}","received_events_url":"https://api.github.com/users/halseth/received_events","type":"User","site_admin":false},"repo":{"id":86519132,"name":"lnd","full_name":"halseth/lnd","owner":{"login":"halseth","id":3765732,"avatar_url":"https://avatars1.githubusercontent.com/u/3765732?v=4","gravatar_id":"","url":"https://api.github.com/users/halseth","html_url":"https://github.com/halseth","followers_url":"https://api.github.com/users/halseth/followers","following_url":"https://api.github.com/users/halseth/following{/other_user}","gists_url":"https://api.github.com/users/halseth/gists{/gist_id}","starred_url":"https://api.github.com/users/halseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halseth/subscriptions","organizations_url":"https://api.github.com/users/halseth/orgs","repos_url":"https://api.github.com/users/halseth/repos","events_url":"https://api.github.com/users/halseth/events{/privacy}","received_events_url":"https://api.github.com/users/halseth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/halseth/lnd","description":"Lightning Network Daemon ⚡️","fork":true,"url":"https://api.github.com/repos/halseth/lnd","forks_url":"https://api.github.com/repos/halseth/lnd/forks","keys_url":"https://api.github.com/repos/halseth/lnd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halseth/lnd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halseth/lnd/teams","hooks_url":"https://api.github.com/repos/halseth/lnd/hooks","issue_events_url":"https://api.github.com/repos/halseth/lnd/issues/events{/number}","events_url":"https://api.github.com/repos/halseth/lnd/events","assignees_url":"https://api.github.com/repos/halseth/lnd/assignees{/user}","branches_url":"https://api.github.com/repos/halseth/lnd/branches{/branch}","tags_url":"https://api.github.com/repos/halseth/lnd/tags","blobs_url":"https://api.github.com/repos/halseth/lnd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halseth/lnd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halseth/lnd/git/refs{/sha}","trees_url":"https://api.github.com/repos/halseth/lnd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halseth/lnd/statuses/{sha}","languages_url":"https://api.github.com/repos/halseth/lnd/languages","stargazers_url":"https://api.github.com/repos/halseth/lnd/stargazers","contributors_url":"https://api.github.com/repos/halseth/lnd/contributors","subscribers_url":"https://api.github.com/repos/halseth/lnd/subscribers","subscription_url":"https://api.github.com/repos/halseth/lnd/subscription","commits_url":"https://api.github.com/repos/halseth/lnd/commits{/sha}","git_commits_url":"https://api.github.com/repos/halseth/lnd/git/commits{/sha}","comments_url":"https://api.github.com/repos/halseth/lnd/comments{/number}","issue_comment_url":"https://api.github.com/repos/halseth/lnd/issues/comments{/number}","contents_url":"https://api.github.com/repos/halseth/lnd/contents/{+path}","compare_url":"https://api.github.com/repos/halseth/lnd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halseth/lnd/merges","archive_url":"https://api.github.com/repos/halseth/lnd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halseth/lnd/downloads","issues_url":"https://api.github.com/repos/halseth/lnd/issues{/number}","pulls_url":"https://api.github.com/repos/halseth/lnd/pulls{/number}","milestones_url":"https://api.github.com/repos/halseth/lnd/milestones{/number}","notifications_url":"https://api.github.com/repos/halseth/lnd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halseth/lnd/labels{/name}","releases_url":"https://api.github.com/repos/halseth/lnd/releases{/id}","deployments_url":"https://api.github.com/repos/halseth/lnd/deployments","created_at":"2017-03-29T00:00:37Z","updated_at":"2018-04-20T12:14:37Z","pushed_at":"2018-04-23T17:12:14Z","git_url":"git://github.com/halseth/lnd.git","ssh_url":"git@github.com:halseth/lnd.git","clone_url":"https://github.com/halseth/lnd.git","svn_url":"https://github.com/halseth/lnd","homepage":"","size":21797,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"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"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lightningnetwork:master","ref":"master","sha":"8af80bfc5cdebcd323ed2a50ea0497df6e9bc6e4","user":{"login":"lightningnetwork","id":13424735,"avatar_url":"https://avatars0.githubusercontent.com/u/13424735?v=4","gravatar_id":"","url":"https://api.github.com/users/lightningnetwork","html_url":"https://github.com/lightningnetwork","followers_url":"https://api.github.com/users/lightningnetwork/followers","following_url":"https://api.github.com/users/lightningnetwork/following{/other_user}","gists_url":"https://api.github.com/users/lightningnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/lightningnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightningnetwork/subscriptions","organizations_url":"https://api.github.com/users/lightningnetwork/orgs","repos_url":"https://api.github.com/users/lightningnetwork/repos","events_url":"https://api.github.com/users/lightningnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/lightningnetwork/received_events","type":"Organization","site_admin":false},"repo":{"id":49765480,"name":"lnd","full_name":"lightningnetwork/lnd","owner":{"login":"lightningnetwork","id":13424735,"avatar_url":"https://avatars0.githubusercontent.com/u/13424735?v=4","gravatar_id":"","url":"https://api.github.com/users/lightningnetwork","html_url":"https://github.com/lightningnetwork","followers_url":"https://api.github.com/users/lightningnetwork/followers","following_url":"https://api.github.com/users/lightningnetwork/following{/other_user}","gists_url":"https://api.github.com/users/lightningnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/lightningnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightningnetwork/subscriptions","organizations_url":"https://api.github.com/users/lightningnetwork/orgs","repos_url":"https://api.github.com/users/lightningnetwork/repos","events_url":"https://api.github.com/users/lightningnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/lightningnetwork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lightningnetwork/lnd","description":"Lightning Network Daemon ⚡️","fork":false,"url":"https://api.github.com/repos/lightningnetwork/lnd","forks_url":"https://api.github.com/repos/lightningnetwork/lnd/forks","keys_url":"https://api.github.com/repos/lightningnetwork/lnd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lightningnetwork/lnd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lightningnetwork/lnd/teams","hooks_url":"https://api.github.com/repos/lightningnetwork/lnd/hooks","issue_events_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/events{/number}","events_url":"https://api.github.com/repos/lightningnetwork/lnd/events","assignees_url":"https://api.github.com/repos/lightningnetwork/lnd/assignees{/user}","branches_url":"https://api.github.com/repos/lightningnetwork/lnd/branches{/branch}","tags_url":"https://api.github.com/repos/lightningnetwork/lnd/tags","blobs_url":"https://api.github.com/repos/lightningnetwork/lnd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lightningnetwork/lnd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lightningnetwork/lnd/git/refs{/sha}","trees_url":"https://api.github.com/repos/lightningnetwork/lnd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lightningnetwork/lnd/statuses/{sha}","languages_url":"https://api.github.com/repos/lightningnetwork/lnd/languages","stargazers_url":"https://api.github.com/repos/lightningnetwork/lnd/stargazers","contributors_url":"https://api.github.com/repos/lightningnetwork/lnd/contributors","subscribers_url":"https://api.github.com/repos/lightningnetwork/lnd/subscribers","subscription_url":"https://api.github.com/repos/lightningnetwork/lnd/subscription","commits_url":"https://api.github.com/repos/lightningnetwork/lnd/commits{/sha}","git_commits_url":"https://api.github.com/repos/lightningnetwork/lnd/git/commits{/sha}","comments_url":"https://api.github.com/repos/lightningnetwork/lnd/comments{/number}","issue_comment_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/comments{/number}","contents_url":"https://api.github.com/repos/lightningnetwork/lnd/contents/{+path}","compare_url":"https://api.github.com/repos/lightningnetwork/lnd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lightningnetwork/lnd/merges","archive_url":"https://api.github.com/repos/lightningnetwork/lnd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lightningnetwork/lnd/downloads","issues_url":"https://api.github.com/repos/lightningnetwork/lnd/issues{/number}","pulls_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls{/number}","milestones_url":"https://api.github.com/repos/lightningnetwork/lnd/milestones{/number}","notifications_url":"https://api.github.com/repos/lightningnetwork/lnd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lightningnetwork/lnd/labels{/name}","releases_url":"https://api.github.com/repos/lightningnetwork/lnd/releases{/id}","deployments_url":"https://api.github.com/repos/lightningnetwork/lnd/deployments","created_at":"2016-01-16T08:19:33Z","updated_at":"2018-04-23T11:12:24Z","pushed_at":"2018-04-24T00:09:42Z","git_url":"git://github.com/lightningnetwork/lnd.git","ssh_url":"git@github.com:lightningnetwork/lnd.git","clone_url":"https://github.com/lightningnetwork/lnd.git","svn_url":"https://github.com/lightningnetwork/lnd","homepage":"","size":14060,"stargazers_count":2482,"watchers_count":2482,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":549,"mirror_url":null,"archived":false,"open_issues_count":139,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":549,"open_issues":139,"watchers":2482,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017"},"html":{"href":"https://github.com/lightningnetwork/lnd/pull/1017"},"issue":{"href":"https://api.github.com/repos/lightningnetwork/lnd/issues/1017"},"comments":{"href":"https://api.github.com/repos/lightningnetwork/lnd/issues/1017/comments"},"review_comments":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017/comments"},"review_comment":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1017/commits"},"statuses":{"href":"https://api.github.com/repos/lightningnetwork/lnd/statuses/9e274995966c1864e0fec02f2cd11469f36b79a7"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Roasbeef"}}