{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/880","labels_url":"https://api.github.com/repos/bitpay/bitcore/issues/880/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore/issues/880/comments","events_url":"https://api.github.com/repos/bitpay/bitcore/issues/880/events","html_url":"https://github.com/bitpay/bitcore/issues/880","id":53234449,"number":880,"title":"Invalid Output Script Buffer Handling","user":{"login":"braydonf","id":544777,"avatar_url":"https://avatars.githubusercontent.com/u/544777?v=3","gravatar_id":"","url":"https://api.github.com/users/braydonf","html_url":"https://github.com/braydonf","followers_url":"https://api.github.com/users/braydonf/followers","following_url":"https://api.github.com/users/braydonf/following{/other_user}","gists_url":"https://api.github.com/users/braydonf/gists{/gist_id}","starred_url":"https://api.github.com/users/braydonf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydonf/subscriptions","organizations_url":"https://api.github.com/users/braydonf/orgs","repos_url":"https://api.github.com/users/braydonf/repos","events_url":"https://api.github.com/users/braydonf/events{/privacy}","received_events_url":"https://api.github.com/users/braydonf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-02T02:02:22Z","updated_at":"2015-01-02T15:08:55Z","closed_at":null,"body":"Output:\r\n```\r\n{ _satoshis: <BN: 0>,\r\n  _scriptBuffer: <Buffer 6a 15 41 53 43 52 49 42 45 53 50 4f 4f 4c 52 45 50 4c 45 4e 49 53 48> }\r\nvar s = new Script(tx.outputs[i]._scriptBuffer)\r\n```\r\nResults in an Error:\r\n```\r\nbuffer.js:582\r\n    throw new RangeError('Trying to access beyond buffer length');\r\n```\r\n\r\nEdit: Perhaps a `valid` method could be added to easily check the state before using the script?"},"comment":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/comments/68532701","html_url":"https://github.com/bitpay/bitcore/issues/880#issuecomment-68532701","issue_url":"https://api.github.com/repos/bitpay/bitcore/issues/880","id":68532701,"user":{"login":"eordano","id":42750,"avatar_url":"https://avatars.githubusercontent.com/u/42750?v=3","gravatar_id":"","url":"https://api.github.com/users/eordano","html_url":"https://github.com/eordano","followers_url":"https://api.github.com/users/eordano/followers","following_url":"https://api.github.com/users/eordano/following{/other_user}","gists_url":"https://api.github.com/users/eordano/gists{/gist_id}","starred_url":"https://api.github.com/users/eordano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eordano/subscriptions","organizations_url":"https://api.github.com/users/eordano/orgs","repos_url":"https://api.github.com/users/eordano/repos","events_url":"https://api.github.com/users/eordano/events{/privacy}","received_events_url":"https://api.github.com/users/eordano/received_events","type":"User","site_admin":false},"created_at":"2015-01-02T15:08:55Z","updated_at":"2015-01-02T15:08:55Z","body":"Hmm, we should change `inspect` so you don't use `._scriptBuffer` and instead use `.script` to do what you're trying to achieve (`new Script(output._scriptBuffer)` should be discouraged as you can just do `output.script`)"}}