File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
packages/bitcore-lib-cash Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Signature.prototype.set = function(obj) {
3030 this . i = typeof obj . i !== 'undefined' ? obj . i : this . i ; //public key recovery parameter in range [0, 3]
3131 this . compressed = typeof obj . compressed !== 'undefined' ?
3232 obj . compressed : this . compressed ; // whether the recovered pubkey is compressed
33- this . isSchnorr = obj . isSchnorr ;
33+ this . isSchnorr = obj . isSchnorr || this . isSchnorr || undefined ;
3434 this . nhashtype = obj . nhashtype || this . nhashtype || undefined ;
3535 return this ;
3636} ;
@@ -207,14 +207,12 @@ Signature.prototype.toCompact = function(i, compressed) {
207207 return Buffer . concat ( [ b1 , b2 , b3 ] ) ;
208208} ;
209209
210- Signature . prototype . toBuffer = Signature . prototype . toDER = function ( signingMethod ) {
210+ Signature . prototype . toBuffer = Signature . prototype . toDER = function ( ) {
211211
212212 // Schnorr signatures use a 64 byte r,s format, where as ECDSA takes the form decribed
213213 // below, above the isDER function signature.
214214
215- signingMethod = signingMethod || "ecdsa" ;
216-
217- if ( signingMethod === "schnorr" ) {
215+ if ( this . isSchnorr ) {
218216 return Buffer . concat ( [ this . r . toBuffer ( { size : 32 } ) , this . s . toBuffer ( { size : 32 } ) ] ) ;
219217 }
220218
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ describe("#Schnorr", function() {
4343 let x = new Signature ( ) ;
4444 x . isSchnorr = true ;
4545 x . set ( schnorr . sig ) ;
46- let str = x . toBuffer ( "schnorr" ) . toString ( 'hex' ) ;
46+ let str = x . toBuffer ( ) . toString ( 'hex' ) ;
4747 str . should . equal ( "005e7ab0906a0164306975916350214a69fb80210cf7e37533f197c3d18b23d1b794262dc663d9e99605784b14ee1ecfca27b602e88dbc87af85f9907c214ea3" ) ;
4848 } ) ;
4949
You can’t perform that action at this time.
0 commit comments