{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/comments/28743825","id":28743825,"diff_hunk":"@@ -200,18 +200,46 @@ Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashT\n   txTmp.ins.forEach(function (txIn) {\n     txIn.script = Script.EMPTY\n   })\n-  txTmp.ins[inIndex].script = hashScript\n+  txTmp.ins[inIndex].script = hashScript;\n+\n+  if ((hashType & 0x1f) === Transaction.SIGHASH_NONE) {\n+    //The output of txTmp is set to a vector of zero size.\n+    txTmp.outs = [];\n+\n+    //All other inputs aside from the current input in txTmp have their nSequence index set to zero\n+    txTmp.ins.forEach(function (input, i) {\n+      if (i != inIndex) {\n+        txCopy.Inputs[i].Sequence = 0;\n+      }\n+    });\n+  }\n \n-  var hashTypeModifier = hashType & 0x1f\n+  if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE) {\n+    //Resize the outputs to inIndex+1 number of entries\n+    txTmp.outs = txTmp.outs.slice(0, inIndex);\n \n-  if (hashTypeModifier === Transaction.SIGHASH_NONE) {\n-    assert(false, 'SIGHASH_NONE not yet supported')\n-  } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) {\n-    assert(false, 'SIGHASH_SINGLE not yet supported')\n+    //All other txTmp outputs aside from the output that is the same as the current input index are set to a blank script and a value of (long) -1.\n+    var stubOut = {\n+      script: Script.EMPTY,\n+      value: -1\n+    }\n+    txTmp.outs.forEach(function (output, i) {\n+      if (i != inIndex) {\n+        txTmp.outs[i] = stubOut;","path":"src/transaction.js","position":35,"original_position":35,"commit_id":"581c826a0ac926dc071cba528cf1e735df4415a1","original_commit_id":"581c826a0ac926dc071cba528cf1e735df4415a1","user":{"login":"dcousens","id":413395,"avatar_url":"https://avatars.githubusercontent.com/u/413395?v=3","gravatar_id":"","url":"https://api.github.com/users/dcousens","html_url":"https://github.com/dcousens","followers_url":"https://api.github.com/users/dcousens/followers","following_url":"https://api.github.com/users/dcousens/following{/other_user}","gists_url":"https://api.github.com/users/dcousens/gists{/gist_id}","starred_url":"https://api.github.com/users/dcousens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcousens/subscriptions","organizations_url":"https://api.github.com/users/dcousens/orgs","repos_url":"https://api.github.com/users/dcousens/repos","events_url":"https://api.github.com/users/dcousens/events{/privacy}","received_events_url":"https://api.github.com/users/dcousens/received_events","type":"User","site_admin":false},"body":"Also,  maybe we should create an object each time.\r\n\r\n``` javascript\r\ntxTmp.outs[i] = {\r\n  script: Script.EMPTY,\r\n  value: -1\r\n}\r\n```","created_at":"2015-04-21T01:22:58Z","updated_at":"2015-04-21T01:22:58Z","html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392#discussion_r28743825","pull_request_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392","_links":{"self":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/comments/28743825"},"html":{"href":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392#discussion_r28743825"},"pull_request":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392","id":32701559,"html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392","diff_url":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392.diff","patch_url":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392.patch","issue_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/392","number":392,"state":"open","locked":false,"title":"Add SIGHASH_NONE, SIGHASH_SINGLE, SIGHASH_ANYONECANPAY hash types","user":{"login":"dthorpe","id":2288043,"avatar_url":"https://avatars.githubusercontent.com/u/2288043?v=3","gravatar_id":"","url":"https://api.github.com/users/dthorpe","html_url":"https://github.com/dthorpe","followers_url":"https://api.github.com/users/dthorpe/followers","following_url":"https://api.github.com/users/dthorpe/following{/other_user}","gists_url":"https://api.github.com/users/dthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dthorpe/subscriptions","organizations_url":"https://api.github.com/users/dthorpe/orgs","repos_url":"https://api.github.com/users/dthorpe/repos","events_url":"https://api.github.com/users/dthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/dthorpe/received_events","type":"User","site_admin":false},"body":"Test scripts written, but unable to run on Windows.","created_at":"2015-04-06T19:04:51Z","updated_at":"2015-04-21T01:22:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51f4c9c59ac26da0f661e69bee587384666e65e1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392/commits","review_comments_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392/comments","review_comment_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/392/comments","statuses_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/statuses/581c826a0ac926dc071cba528cf1e735df4415a1","head":{"label":"dthorpe:master","ref":"master","sha":"581c826a0ac926dc071cba528cf1e735df4415a1","user":{"login":"dthorpe","id":2288043,"avatar_url":"https://avatars.githubusercontent.com/u/2288043?v=3","gravatar_id":"","url":"https://api.github.com/users/dthorpe","html_url":"https://github.com/dthorpe","followers_url":"https://api.github.com/users/dthorpe/followers","following_url":"https://api.github.com/users/dthorpe/following{/other_user}","gists_url":"https://api.github.com/users/dthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dthorpe/subscriptions","organizations_url":"https://api.github.com/users/dthorpe/orgs","repos_url":"https://api.github.com/users/dthorpe/repos","events_url":"https://api.github.com/users/dthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/dthorpe/received_events","type":"User","site_admin":false},"repo":{"id":33373002,"name":"bitcoinjs-lib","full_name":"dthorpe/bitcoinjs-lib","owner":{"login":"dthorpe","id":2288043,"avatar_url":"https://avatars.githubusercontent.com/u/2288043?v=3","gravatar_id":"","url":"https://api.github.com/users/dthorpe","html_url":"https://github.com/dthorpe","followers_url":"https://api.github.com/users/dthorpe/followers","following_url":"https://api.github.com/users/dthorpe/following{/other_user}","gists_url":"https://api.github.com/users/dthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dthorpe/subscriptions","organizations_url":"https://api.github.com/users/dthorpe/orgs","repos_url":"https://api.github.com/users/dthorpe/repos","events_url":"https://api.github.com/users/dthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/dthorpe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dthorpe/bitcoinjs-lib","description":"Bitcoin-related functions implemented in pure JavaScript","fork":true,"url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib","forks_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/forks","keys_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/teams","hooks_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/hooks","issue_events_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/issues/events{/number}","events_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/events","assignees_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/assignees{/user}","branches_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/branches{/branch}","tags_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/tags","blobs_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/languages","stargazers_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/stargazers","contributors_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/contributors","subscribers_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/subscribers","subscription_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/subscription","commits_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/contents/{+path}","compare_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/merges","archive_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/downloads","issues_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/issues{/number}","pulls_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/labels{/name}","releases_url":"https://api.github.com/repos/dthorpe/bitcoinjs-lib/releases{/id}","created_at":"2015-04-03T16:55:08Z","updated_at":"2015-04-20T16:28:13Z","pushed_at":"2015-04-20T16:28:13Z","git_url":"git://github.com/dthorpe/bitcoinjs-lib.git","ssh_url":"git@github.com:dthorpe/bitcoinjs-lib.git","clone_url":"https://github.com/dthorpe/bitcoinjs-lib.git","svn_url":"https://github.com/dthorpe/bitcoinjs-lib","homepage":"http://bitcoinjs.org","size":2016,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bitcoinjs:master","ref":"master","sha":"c66b8883f782caf6fd55c649b38c70a0cc1559ab","user":{"login":"bitcoinjs","id":756696,"avatar_url":"https://avatars.githubusercontent.com/u/756696?v=3","gravatar_id":"","url":"https://api.github.com/users/bitcoinjs","html_url":"https://github.com/bitcoinjs","followers_url":"https://api.github.com/users/bitcoinjs/followers","following_url":"https://api.github.com/users/bitcoinjs/following{/other_user}","gists_url":"https://api.github.com/users/bitcoinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoinjs/subscriptions","organizations_url":"https://api.github.com/users/bitcoinjs/orgs","repos_url":"https://api.github.com/users/bitcoinjs/repos","events_url":"https://api.github.com/users/bitcoinjs/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoinjs/received_events","type":"Organization","site_admin":false},"repo":{"id":1701968,"name":"bitcoinjs-lib","full_name":"bitcoinjs/bitcoinjs-lib","owner":{"login":"bitcoinjs","id":756696,"avatar_url":"https://avatars.githubusercontent.com/u/756696?v=3","gravatar_id":"","url":"https://api.github.com/users/bitcoinjs","html_url":"https://github.com/bitcoinjs","followers_url":"https://api.github.com/users/bitcoinjs/followers","following_url":"https://api.github.com/users/bitcoinjs/following{/other_user}","gists_url":"https://api.github.com/users/bitcoinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoinjs/subscriptions","organizations_url":"https://api.github.com/users/bitcoinjs/orgs","repos_url":"https://api.github.com/users/bitcoinjs/repos","events_url":"https://api.github.com/users/bitcoinjs/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoinjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitcoinjs/bitcoinjs-lib","description":"Bitcoin-related functions implemented in pure JavaScript","fork":false,"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib","forks_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/forks","keys_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/teams","hooks_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/hooks","issue_events_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/events{/number}","events_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/events","assignees_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/assignees{/user}","branches_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/branches{/branch}","tags_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/tags","blobs_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/languages","stargazers_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/stargazers","contributors_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/contributors","subscribers_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/subscribers","subscription_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/subscription","commits_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/contents/{+path}","compare_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/merges","archive_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/downloads","issues_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues{/number}","pulls_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/labels{/name}","releases_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/releases{/id}","created_at":"2011-05-04T16:03:45Z","updated_at":"2015-04-18T19:36:39Z","pushed_at":"2015-04-20T16:28:14Z","git_url":"git://github.com/bitcoinjs/bitcoinjs-lib.git","ssh_url":"git@github.com:bitcoinjs/bitcoinjs-lib.git","clone_url":"https://github.com/bitcoinjs/bitcoinjs-lib.git","svn_url":"https://github.com/bitcoinjs/bitcoinjs-lib","homepage":"http://bitcoinjs.org","size":6339,"stargazers_count":808,"watchers_count":808,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":250,"mirror_url":null,"open_issues_count":18,"forks":250,"open_issues":18,"watchers":808,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392"},"html":{"href":"https://github.com/bitcoinjs/bitcoinjs-lib/pull/392"},"issue":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/392"},"comments":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/392/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/pulls/392/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/statuses/581c826a0ac926dc071cba528cf1e735df4415a1"}}}}