|
|
@ -19,6 +19,9 @@ var TransactionSignature = require('../signature'); |
|
|
|
function MultiSigScriptHashInput(input, pubkeys, threshold, signatures) { |
|
|
|
Input.apply(this, arguments); |
|
|
|
var self = this; |
|
|
|
pubkeys = pubkeys || input.publicKeys; |
|
|
|
threshold = threshold || input.threshold; |
|
|
|
signatures = signatures || input.signatures; |
|
|
|
this.publicKeys = _.sortBy(pubkeys, function(publicKey) { return publicKey.toString('hex'); }); |
|
|
|
this.redeemScript = Script.buildMultisigOut(this.publicKeys, threshold); |
|
|
|
$.checkState(Script.buildScriptHashOut(this.redeemScript).equals(this.output.script), |
|
|
@ -46,14 +49,7 @@ MultiSigScriptHashInput.prototype._deserializeSignatures = function(signatures) |
|
|
|
if (!signature) { |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
return new TransactionSignature({ |
|
|
|
publicKey: new PublicKey(signature.publicKey), |
|
|
|
prevTxId: signature.txId, |
|
|
|
outputIndex: signature.outputIndex, |
|
|
|
inputIndex: signature.inputIndex, |
|
|
|
signature: Signature.fromString(signature.signature), |
|
|
|
sigtype: signature.sigtype |
|
|
|
}); |
|
|
|
return new TransactionSignature(signature); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
@ -62,14 +58,7 @@ MultiSigScriptHashInput.prototype._serializeSignatures = function() { |
|
|
|
if (!signature) { |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
return new TransactionSignature({ |
|
|
|
publicKey: signature.publicKey.toString(), |
|
|
|
prevTxId: signature.txId, |
|
|
|
outputIndex: signature.outputIndex, |
|
|
|
inputIndex: signature.inputIndex, |
|
|
|
signature: signature.signature.toString(), |
|
|
|
sigtype: signature.sigtype |
|
|
|
}); |
|
|
|
return signature.toObject(); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|