{"action":"created","comment":{"url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments/241742159","pull_request_review_id":185091997,"id":241742159,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTc0MjE1OQ==","diff_hunk":"@@ -143,9 +144,51 @@ func (s *UtxoSweeper) CreateSweepTx(inputs []Input, confTarget uint32,\n \treturn sweepTx, nil\n }\n \n+// getInputWitnessSizeUpperBound returns the maximum length of the witness for\n+// the given input if it would be included in a tx.\n+func getInputWitnessSizeUpperBound(input Input) (int, error) {\n+\tswitch input.WitnessType() {\n+\n+\t// Outputs on a remote commitment transaction that pay directly\n+\t// to us.\n+\tcase lnwallet.CommitmentNoDelay:\n+\t\treturn lnwallet.P2WKHWitnessSize, nil\n+\n+\t// Outputs on a past commitment transaction that pay directly\n+\t// to us.\n+\tcase lnwallet.CommitmentTimeLock:\n+\t\treturn lnwallet.ToLocalTimeoutWitnessSize, nil\n+\n+\t// Outgoing second layer HTLC's that have confirmed within the\n+\t// chain, and the output they produced is now mature enough to\n+\t// sweep.\n+\tcase lnwallet.HtlcOfferedTimeoutSecondLevel:\n+\t\treturn lnwallet.ToLocalTimeoutWitnessSize, nil\n+\n+\t// Incoming second layer HTLC's that have confirmed within the\n+\t// chain, and the output they produced is now mature enough to\n+\t// sweep.\n+\tcase lnwallet.HtlcAcceptedSuccessSecondLevel:\n+\t\treturn lnwallet.ToLocalTimeoutWitnessSize, nil\n+\n+\t// An HTLC on the commitment transaction of the remote party,\n+\t// that has had its absolute timelock expire.\n+\tcase lnwallet.HtlcOfferedRemoteTimeout:\n+\t\treturn lnwallet.AcceptedHtlcTimeoutWitnessSize, nil\n+\n+\t// An HTLC on the commitment transaction of the remote party,\n+\t// that can be swept with the preimage.\n+\tcase lnwallet.HtlcAcceptedRemoteSuccess:\n+\t\treturn lnwallet.OfferedHtlcSuccessWitnessSize, nil\n+\n+\t}\n+\n+\treturn 0, fmt.Errorf(\"unexpected witness type: %v\", input.WitnessType())","path":"sweep/sweeper.go","position":null,"original_position":60,"commit_id":"d425012d081db543f4e742854a6d4f3e97d915a1","original_commit_id":"b0e32f840f836a33598b502b8a0cc135aa7ffc48","user":{"login":"halseth","id":3765732,"node_id":"MDQ6VXNlcjM3NjU3MzI=","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":"Just looks longer than the lines above it.","created_at":"2018-12-14T12:41:02Z","updated_at":"2018-12-14T12:41:02Z","html_url":"https://github.com/lightningnetwork/lnd/pull/1960#discussion_r241742159","pull_request_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments/241742159"},"html":{"href":"https://github.com/lightningnetwork/lnd/pull/1960#discussion_r241742159"},"pull_request":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960"}},"in_reply_to_id":240565512},"pull_request":{"url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960","id":217363123,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MzYzMTIz","html_url":"https://github.com/lightningnetwork/lnd/pull/1960","diff_url":"https://github.com/lightningnetwork/lnd/pull/1960.diff","patch_url":"https://github.com/lightningnetwork/lnd/pull/1960.patch","issue_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/1960","number":1960,"state":"open","locked":false,"title":"sweep: create sweeper","user":{"login":"joostjager","id":4638168,"node_id":"MDQ6VXNlcjQ2MzgxNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/4638168?v=4","gravatar_id":"","url":"https://api.github.com/users/joostjager","html_url":"https://github.com/joostjager","followers_url":"https://api.github.com/users/joostjager/followers","following_url":"https://api.github.com/users/joostjager/following{/other_user}","gists_url":"https://api.github.com/users/joostjager/gists{/gist_id}","starred_url":"https://api.github.com/users/joostjager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joostjager/subscriptions","organizations_url":"https://api.github.com/users/joostjager/orgs","repos_url":"https://api.github.com/users/joostjager/repos","events_url":"https://api.github.com/users/joostjager/events{/privacy}","received_events_url":"https://api.github.com/users/joostjager/received_events","type":"User","site_admin":false},"body":"This PR moves the sweeper logic from `utxonursery` into a separate sweeper struct.\r\n\r\nA follow up PR is #2000, which will let resolvers use the sweeper directly instead of going through nursery. The end goal is to remove nursery completely.\r\n\r\nIn this PR, there is no db migration to clean up now unused nursery store data. This allows us to keep the downgrade path open for a while.","created_at":"2018-09-21T18:19:23Z","updated_at":"2018-12-14T12:41:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be46b17068fd9cf40ee4288e95224560a6ee37cc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":990013318,"node_id":"MDU6TGFiZWw5OTAwMTMzMTg=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/P2","name":"P2","color":"fbca04","default":false},{"id":778122277,"node_id":"MDU6TGFiZWw3NzgxMjIyNzc=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/channel%20management","name":"channel management","color":"5fa7bf","default":false},{"id":923266457,"node_id":"MDU6TGFiZWw5MjMyNjY0NTc=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/contracts","name":"contracts","color":"e09523","default":false},{"id":312148187,"node_id":"MDU6TGFiZWwzMTIxNDgxODc=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":990064318,"node_id":"MDU6TGFiZWw5OTAwNjQzMTg=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/needs%20testing","name":"needs testing","color":"a4f963","default":false},{"id":990053448,"node_id":"MDU6TGFiZWw5OTAwNTM0NDg=","url":"https://api.github.com/repos/lightningnetwork/lnd/labels/utxo%20sweeping","name":"utxo sweeping","color":"5df4e0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960/commits","review_comments_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960/comments","review_comment_url":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lightningnetwork/lnd/issues/1960/comments","statuses_url":"https://api.github.com/repos/lightningnetwork/lnd/statuses/d425012d081db543f4e742854a6d4f3e97d915a1","head":{"label":"joostjager:sweeper","ref":"sweeper","sha":"d425012d081db543f4e742854a6d4f3e97d915a1","user":{"login":"joostjager","id":4638168,"node_id":"MDQ6VXNlcjQ2MzgxNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/4638168?v=4","gravatar_id":"","url":"https://api.github.com/users/joostjager","html_url":"https://github.com/joostjager","followers_url":"https://api.github.com/users/joostjager/followers","following_url":"https://api.github.com/users/joostjager/following{/other_user}","gists_url":"https://api.github.com/users/joostjager/gists{/gist_id}","starred_url":"https://api.github.com/users/joostjager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joostjager/subscriptions","organizations_url":"https://api.github.com/users/joostjager/orgs","repos_url":"https://api.github.com/users/joostjager/repos","events_url":"https://api.github.com/users/joostjager/events{/privacy}","received_events_url":"https://api.github.com/users/joostjager/received_events","type":"User","site_admin":false},"repo":{"id":133927509,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5Mjc1MDk=","name":"lnd","full_name":"joostjager/lnd","private":false,"owner":{"login":"joostjager","id":4638168,"node_id":"MDQ6VXNlcjQ2MzgxNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/4638168?v=4","gravatar_id":"","url":"https://api.github.com/users/joostjager","html_url":"https://github.com/joostjager","followers_url":"https://api.github.com/users/joostjager/followers","following_url":"https://api.github.com/users/joostjager/following{/other_user}","gists_url":"https://api.github.com/users/joostjager/gists{/gist_id}","starred_url":"https://api.github.com/users/joostjager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joostjager/subscriptions","organizations_url":"https://api.github.com/users/joostjager/orgs","repos_url":"https://api.github.com/users/joostjager/repos","events_url":"https://api.github.com/users/joostjager/events{/privacy}","received_events_url":"https://api.github.com/users/joostjager/received_events","type":"User","site_admin":false},"html_url":"https://github.com/joostjager/lnd","description":"Lightning Network Daemon ⚡️","fork":true,"url":"https://api.github.com/repos/joostjager/lnd","forks_url":"https://api.github.com/repos/joostjager/lnd/forks","keys_url":"https://api.github.com/repos/joostjager/lnd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joostjager/lnd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joostjager/lnd/teams","hooks_url":"https://api.github.com/repos/joostjager/lnd/hooks","issue_events_url":"https://api.github.com/repos/joostjager/lnd/issues/events{/number}","events_url":"https://api.github.com/repos/joostjager/lnd/events","assignees_url":"https://api.github.com/repos/joostjager/lnd/assignees{/user}","branches_url":"https://api.github.com/repos/joostjager/lnd/branches{/branch}","tags_url":"https://api.github.com/repos/joostjager/lnd/tags","blobs_url":"https://api.github.com/repos/joostjager/lnd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joostjager/lnd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joostjager/lnd/git/refs{/sha}","trees_url":"https://api.github.com/repos/joostjager/lnd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joostjager/lnd/statuses/{sha}","languages_url":"https://api.github.com/repos/joostjager/lnd/languages","stargazers_url":"https://api.github.com/repos/joostjager/lnd/stargazers","contributors_url":"https://api.github.com/repos/joostjager/lnd/contributors","subscribers_url":"https://api.github.com/repos/joostjager/lnd/subscribers","subscription_url":"https://api.github.com/repos/joostjager/lnd/subscription","commits_url":"https://api.github.com/repos/joostjager/lnd/commits{/sha}","git_commits_url":"https://api.github.com/repos/joostjager/lnd/git/commits{/sha}","comments_url":"https://api.github.com/repos/joostjager/lnd/comments{/number}","issue_comment_url":"https://api.github.com/repos/joostjager/lnd/issues/comments{/number}","contents_url":"https://api.github.com/repos/joostjager/lnd/contents/{+path}","compare_url":"https://api.github.com/repos/joostjager/lnd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joostjager/lnd/merges","archive_url":"https://api.github.com/repos/joostjager/lnd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joostjager/lnd/downloads","issues_url":"https://api.github.com/repos/joostjager/lnd/issues{/number}","pulls_url":"https://api.github.com/repos/joostjager/lnd/pulls{/number}","milestones_url":"https://api.github.com/repos/joostjager/lnd/milestones{/number}","notifications_url":"https://api.github.com/repos/joostjager/lnd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joostjager/lnd/labels{/name}","releases_url":"https://api.github.com/repos/joostjager/lnd/releases{/id}","deployments_url":"https://api.github.com/repos/joostjager/lnd/deployments","created_at":"2018-05-18T08:40:36Z","updated_at":"2018-10-08T12:26:51Z","pushed_at":"2018-12-14T08:07:03Z","git_url":"git://github.com/joostjager/lnd.git","ssh_url":"git@github.com:joostjager/lnd.git","clone_url":"https://github.com/joostjager/lnd.git","svn_url":"https://github.com/joostjager/lnd","homepage":"","size":24172,"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":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lightningnetwork:master","ref":"master","sha":"0fafd5e2fd824f38ec6a03a56488de9c0798f34f","user":{"login":"lightningnetwork","id":13424735,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDI0NzM1","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,"node_id":"MDEwOlJlcG9zaXRvcnk0OTc2NTQ4MA==","name":"lnd","full_name":"lightningnetwork/lnd","private":false,"owner":{"login":"lightningnetwork","id":13424735,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDI0NzM1","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},"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-12-14T07:33:48Z","pushed_at":"2018-12-14T10:07:43Z","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":24074,"stargazers_count":3287,"watchers_count":3287,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":838,"mirror_url":null,"archived":false,"open_issues_count":332,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":838,"open_issues":332,"watchers":3287,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960"},"html":{"href":"https://github.com/lightningnetwork/lnd/pull/1960"},"issue":{"href":"https://api.github.com/repos/lightningnetwork/lnd/issues/1960"},"comments":{"href":"https://api.github.com/repos/lightningnetwork/lnd/issues/1960/comments"},"review_comments":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960/comments"},"review_comment":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lightningnetwork/lnd/pulls/1960/commits"},"statuses":{"href":"https://api.github.com/repos/lightningnetwork/lnd/statuses/d425012d081db543f4e742854a6d4f3e97d915a1"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"halseth"}}