|
|
@ -756,7 +756,7 @@ fnToSign[Script.TX_SCRIPTHASH] = TransactionBuilder.prototype._signScriptHash; |
|
|
|
//
|
|
|
|
//
|
|
|
|
TransactionBuilder.prototype.sign = function(keys) { |
|
|
|
if (! (keys instanceof Array)) |
|
|
|
if (!(keys instanceof Array)) |
|
|
|
throw new Error('parameter should be an array'); |
|
|
|
|
|
|
|
this._checkTx(); |
|
|
@ -856,7 +856,7 @@ TransactionBuilder.fromObj = function(data) { |
|
|
|
b.tx.ins[i].s = new Buffer(data.scriptSig[i], 'hex'); |
|
|
|
|
|
|
|
var scriptSig = new Script(b.tx.ins[i].s); |
|
|
|
if ( scriptSig.finishedMultiSig() !== false ) |
|
|
|
if (scriptSig.finishedMultiSig() !== false) |
|
|
|
b.inputsSigned++; |
|
|
|
} |
|
|
|
} |
|
|
@ -866,7 +866,7 @@ TransactionBuilder.fromObj = function(data) { |
|
|
|
|
|
|
|
|
|
|
|
TransactionBuilder.prototype._checkMergeability = function(b) { |
|
|
|
if ( JSON.stringify(this.vanilla) !== JSON.stringify(this.vanilla)) |
|
|
|
if (JSON.stringify(this.vanilla) !== JSON.stringify(this.vanilla)) |
|
|
|
throw new Error('cannot merge: incompatible builders') |
|
|
|
}; |
|
|
|
|
|
|
@ -910,16 +910,16 @@ TransactionBuilder.prototype._mergeInputSigP2sh = function(input, s0, s1) { |
|
|
|
|
|
|
|
// TODO: move this to script
|
|
|
|
TransactionBuilder.prototype._getSighashType = function(sig) { |
|
|
|
return sig[sig.length-1]; |
|
|
|
return sig[sig.length - 1]; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
TransactionBuilder.prototype._checkSignHash = function(s1) { |
|
|
|
var l = s1.chunks.length-1; |
|
|
|
var l = s1.chunks.length - 1; |
|
|
|
|
|
|
|
for(var i=0; i<l; i++) { |
|
|
|
for (var i = 0; i < l; i++) { |
|
|
|
|
|
|
|
if (i==0 && s1.chunks[i] === 0) |
|
|
|
if (i == 0 && s1.chunks[i] === 0) |
|
|
|
continue; |
|
|
|
|
|
|
|
if (this._getSighashType(s1.chunks[i]) !== this.signhash) |
|
|
@ -990,7 +990,7 @@ TransactionBuilder.prototype._mergeTx = function(tx) { |
|
|
|
throw new Error('TX .o in mismatch in merge. Input:', i); |
|
|
|
|
|
|
|
i0.s = this._mergeInputSig(i, i0.s, i1.s); |
|
|
|
this.vanilla.scriptSig[i]= i0.s.toString('hex'); |
|
|
|
this.vanilla.scriptSig[i] = i0.s.toString('hex'); |
|
|
|
|
|
|
|
if (v0.isInputComplete(i)) this.inputsSigned++; |
|
|
|
} |
|
|
|