improve address.ownInput.
This commit is contained in:
parent
13d14b0130
commit
f6fe37be6b
@ -387,14 +387,15 @@ Address.prototype.ownInput = function ownInput(tx, index) {
|
||||
var inputs;
|
||||
|
||||
inputs = tx.inputs.filter(function(input, i) {
|
||||
var s;
|
||||
|
||||
if (!input.prevout.tx && this.tx._all[input.prevout.hash])
|
||||
input.prevout.tx = this.tx._all[input.prevout.hash];
|
||||
|
||||
if (index != null && index !== i)
|
||||
return false;
|
||||
|
||||
if (input.prevout.tx)
|
||||
return !!this.ownOutput(input.prevout.tx, input.prevout.index);
|
||||
|
||||
// if (bcoin.script.isPubkeyInput(input.script, key, tx, i))
|
||||
// return true;
|
||||
|
||||
@ -409,25 +410,6 @@ Address.prototype.ownInput = function ownInput(tx, index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!input.prevout.tx)
|
||||
return false;
|
||||
|
||||
s = input.prevout.tx.getSubscript(input.prevout.index);
|
||||
|
||||
if (bcoin.script.isPubkey(s, key))
|
||||
return true;
|
||||
|
||||
if (bcoin.script.isPubkeyhash(s, hash))
|
||||
return true;
|
||||
|
||||
if (bcoin.script.isMultisig(s, keys))
|
||||
return true;
|
||||
|
||||
if (scriptHash) {
|
||||
if (bcoin.script.isScripthash(s, scriptHash))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}, this);
|
||||
|
||||
|
||||
@ -429,7 +429,7 @@ Wallet.prototype.createTX = function createTX(outputs, fee) {
|
||||
Wallet.prototype.scriptInputs = function scriptInputs(tx) {
|
||||
this.fillPrevout(tx);
|
||||
return this.addresses.reduce(function(total, address) {
|
||||
return total + address.signInputs(tx);
|
||||
return total + address.scriptInputs(tx);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user