From db3ffe58d1a3f6800e21f34a1139ddb1929e6a80 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 17 May 2014 00:27:54 +1000 Subject: [PATCH] message: use serializeSigCompact --- src/message.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/message.js b/src/message.js index 58715b4..15c355a 100644 --- a/src/message.js +++ b/src/message.js @@ -27,15 +27,7 @@ function sign(key, message, network) { var sig = ecdsa.parseSig(key.sign(hash)) var i = ecdsa.calcPubKeyRecoveryParam(key.pub.Q, sig.r, sig.s, hash) - i += 27 - if (key.pub.compressed) { - i += 4 - } - - var rB = sig.r.toBuffer(32) - var sB = sig.s.toBuffer(32) - - return Buffer.concat([new Buffer([i]), rB, sB], 65) + return ecdsa.serializeSigCompact(sig.r, sig.s, i, key.pub.compressed) } // TODO: network could be implied from address