Use addInput in _fromNonP2SH

This commit is contained in:
Esteban Ordano 2015-02-04 12:10:47 -03:00
parent b7ef077591
commit bd97f20f1c
1 changed files with 7 additions and 2 deletions

View File

@ -353,8 +353,14 @@ Transaction.prototype.from = function(utxo, pubkeys, threshold) {
}; };
Transaction.prototype._fromNonP2SH = function(utxo) { Transaction.prototype._fromNonP2SH = function(utxo) {
var clazz;
utxo = new UnspentOutput(utxo); utxo = new UnspentOutput(utxo);
this.inputs.push(new PublicKeyHashInput({ if (utxo.script.isPublicKeyHashOut()) {
clazz = PublicKeyHashInput;
} else {
clazz = Input;
}
this.addInput(new clazz({
output: new Output({ output: new Output({
script: utxo.script, script: utxo.script,
satoshis: utxo.satoshis satoshis: utxo.satoshis
@ -364,7 +370,6 @@ Transaction.prototype._fromNonP2SH = function(utxo) {
sequenceNumber: DEFAULT_SEQNUMBER, sequenceNumber: DEFAULT_SEQNUMBER,
script: Script.empty() script: Script.empty()
})); }));
this._inputAmount += utxo.satoshis;
}; };
Transaction.prototype._fromMultisigUtxo = function(utxo, pubkeys, threshold) { Transaction.prototype._fromMultisigUtxo = function(utxo, pubkeys, threshold) {