Skip to content

Conversation

@dcousens
Copy link
Contributor

Chained on #212.

This pull request moves all the ecdsa serialize/parse functions to ECSignature, a new class interface for importing/exporting ECSignatures.

The code is straight forward enough, with the test data broken away from ecdsa fixtures, but not altered.
ECSignature.fromScriptSignature was also added to import DER signatures with a hashType byte appended on the end. It is up for debate whether this is worthwhile for now. But it will be worthwhile if we instead pass around this object and only encode it when a script signature is made.
That is, instead of createPubKeyScriptSig(DERsignatureBuffer), it is instead:

createPubKeyScriptSig = function(txSignatureInfo) {
  var signature = txSignatureInfo.signature
  var hashType = txSignatureInfo.hashType

  return Script.fromChunks([signature.toScriptSignature(hashType)])
}

This saves serialization to DER until is necessary, meaning we can allow for easier verification of signatures as an intermediary step.
This may not be the best solution, so I'm open for other ideas.

Comparison link: https://github.com/dcousens/bitcoinjs-lib/compare/txclean...ecsignature

@dcousens
Copy link
Contributor Author

Added a jshint cleanup and upgrade to 0.9.0 of ecurve.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling f429932 on dcousens:ecsignature into 4f0ae1a on bitcoinjs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 1f0a54f on dcousens:ecsignature into 4f0ae1a on bitcoinjs:master.

weilu added a commit that referenced this pull request Jun 16, 2014
@weilu weilu merged commit e2cf354 into bitcoinjs:master Jun 16, 2014
@dcousens dcousens deleted the ecsignature branch June 16, 2014 15:08
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.

3 participants