From 9951b55a4fb2bee2e8e77503f5bf28e349c25236 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 22 Apr 2014 21:08:48 -0300 Subject: [PATCH] signature sorting in .sign and .merge in transaction builder --- lib/Script.js | 55 ++++++- lib/Transaction.js | 14 +- lib/TransactionBuilder.js | 260 ++++++++++++++++++-------------- test/test.Script.js | 4 +- test/test.TransactionBuilder.js | 80 ++++------ 5 files changed, 241 insertions(+), 172 deletions(-) diff --git a/lib/Script.js b/lib/Script.js index fcba36b..7c62f66 100644 --- a/lib/Script.js +++ b/lib/Script.js @@ -119,19 +119,64 @@ Script.prototype.isMultiSig = function() { this.chunks[this.chunks.length - 1] == OP_CHECKMULTISIG); }; + + + +// FOR TESTING +var _dumpChunks = function (scriptSig, label) { + console.log('## DUMP: ' + label + ' ##'); + for(var i=0; i2) || (l1<2 && l0>2 ))) throw new Error('TX sig types mismatch in merge'); - if (!l0 && !l1) return s0buf; - if ( l0 && !l1) return s0buf; - if (!l0 && l1) return s1buf; - - // Look for differences. - for (var i=0; i