Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Invalid Output Scripts. Closes #1230 #1231

Merged
merged 1 commit into from
May 14, 2015

Conversation

braydonf
Copy link
Contributor

  • Changed toObject serialization to always use a hexa string for a script
  • Updated inspect method to handle a null script
  • Roundtrip toObject with an invalid script
  • Additional test coverage for Output

@braydonf braydonf changed the title Add test case for invalid script in valid bitcoin block. WIP: Add test case for invalid script in valid bitcoin block. May 13, 2015
@braydonf braydonf force-pushed the bug/output-to-script branch from fa7f313 to a23b364 Compare May 13, 2015 14:39
@braydonf braydonf changed the title WIP: Add test case for invalid script in valid bitcoin block. WIP: Handling Invalid Output Scripts May 13, 2015
var output = new Output({
satoshis: 1000,
script: 'bad'
});
}).should.throw('Invalid hex string');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to throw a more specific error? (i.e: errors.Transaction.Output.InvalidScript)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error from Buffer that will take the else path, so we can handle an InvalidScript but not other types of errors.

@braydonf braydonf changed the title WIP: Handling Invalid Output Scripts WIP: Handling Invalid Output Scripts. Closes #1230 May 13, 2015
@braydonf braydonf force-pushed the bug/output-to-script branch 4 times, most recently from 9e19411 to cb9996f Compare May 14, 2015 00:49
@braydonf braydonf changed the title WIP: Handling Invalid Output Scripts. Closes #1230 Handling Invalid Output Scripts. Closes #1230 May 14, 2015
- Changed toObject serialization to always use a hexa string for a script
- Updated inspect method to handle a null script
- Roundtrip toObject/fromObject with an invalid script
- Additional test coverage for Output
@braydonf braydonf force-pushed the bug/output-to-script branch from cb9996f to 458abe0 Compare May 14, 2015 05:50
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) to 97.79% when pulling 458abe0 on braydonf:bug/output-to-script into 0dbd9db on bitpay:master.

@pnagurny
Copy link
Contributor

Looks good to me

pnagurny added a commit that referenced this pull request May 14, 2015
Handling Invalid Output Scripts. Closes #1230
@pnagurny pnagurny merged commit 796fbc2 into bitpay:master May 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants