diff --git a/lib/TransactionBuilder.js b/lib/TransactionBuilder.js index cc34fff..e0cbfe3 100644 --- a/lib/TransactionBuilder.js +++ b/lib/TransactionBuilder.js @@ -105,7 +105,7 @@ function TransactionBuilder(opts) { // If any default opts is changed, TOOBJ_VERSION should be changed as // a caution measure. - + this.lockTime = opts.lockTime || 0; this.spendUnconfirmed = opts.spendUnconfirmed || false; @@ -464,7 +464,7 @@ TransactionBuilder._signHashAndVerify = function(wk, txSigHash) { }; TransactionBuilder.prototype._checkTx = function() { - if (!this.tx || !this.tx.ins || !this.tx.ins.length || !this.tx.outs.length) + if (!this.tx || !this.tx.ins || !this.tx.ins.length || !this.tx.outs.length) throw new Error('tx is not defined'); }; @@ -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(); @@ -844,7 +844,7 @@ TransactionBuilder.fromObj = function(data) { var b = new TransactionBuilder(data.opts); if (data.utxos) { - b.setUnspent(data.utxos); + b.setUnspent(data.utxos); if (data.hashToScriptMap) b.setHashToScriptMap(data.hashToScriptMap); @@ -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