formated using js-beautify
This commit is contained in:
parent
8e1de31797
commit
68b1211c4c
@ -464,7 +464,7 @@ TransactionBuilder._signHashAndVerify = function(wk, txSigHash) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TransactionBuilder.prototype._checkTx = function() {
|
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');
|
throw new Error('tx is not defined');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -756,7 +756,7 @@ fnToSign[Script.TX_SCRIPTHASH] = TransactionBuilder.prototype._signScriptHash;
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
TransactionBuilder.prototype.sign = function(keys) {
|
TransactionBuilder.prototype.sign = function(keys) {
|
||||||
if (! (keys instanceof Array))
|
if (!(keys instanceof Array))
|
||||||
throw new Error('parameter should be an array');
|
throw new Error('parameter should be an array');
|
||||||
|
|
||||||
this._checkTx();
|
this._checkTx();
|
||||||
@ -856,7 +856,7 @@ TransactionBuilder.fromObj = function(data) {
|
|||||||
b.tx.ins[i].s = new Buffer(data.scriptSig[i], 'hex');
|
b.tx.ins[i].s = new Buffer(data.scriptSig[i], 'hex');
|
||||||
|
|
||||||
var scriptSig = new Script(b.tx.ins[i].s);
|
var scriptSig = new Script(b.tx.ins[i].s);
|
||||||
if ( scriptSig.finishedMultiSig() !== false )
|
if (scriptSig.finishedMultiSig() !== false)
|
||||||
b.inputsSigned++;
|
b.inputsSigned++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,7 +866,7 @@ TransactionBuilder.fromObj = function(data) {
|
|||||||
|
|
||||||
|
|
||||||
TransactionBuilder.prototype._checkMergeability = function(b) {
|
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')
|
throw new Error('cannot merge: incompatible builders')
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -910,16 +910,16 @@ TransactionBuilder.prototype._mergeInputSigP2sh = function(input, s0, s1) {
|
|||||||
|
|
||||||
// TODO: move this to script
|
// TODO: move this to script
|
||||||
TransactionBuilder.prototype._getSighashType = function(sig) {
|
TransactionBuilder.prototype._getSighashType = function(sig) {
|
||||||
return sig[sig.length-1];
|
return sig[sig.length - 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TransactionBuilder.prototype._checkSignHash = function(s1) {
|
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;
|
continue;
|
||||||
|
|
||||||
if (this._getSighashType(s1.chunks[i]) !== this.signhash)
|
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);
|
throw new Error('TX .o in mismatch in merge. Input:', i);
|
||||||
|
|
||||||
i0.s = this._mergeInputSig(i, i0.s, i1.s);
|
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++;
|
if (v0.isInputComplete(i)) this.inputsSigned++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user