improve tx verification.
This commit is contained in:
parent
ef59dae1b5
commit
6154b1f7a1
@ -689,13 +689,20 @@ TX.prototype.verify = function verify(index, force, flags) {
|
||||
if (!input.out.tx)
|
||||
return false;
|
||||
|
||||
output = input.out.tx.outputs[input.out.index];
|
||||
|
||||
assert(input.out.tx.outputs.length > input.out.index);
|
||||
// Somethis is very wrong if this is
|
||||
// not the case.
|
||||
assert.equal(input.out.tx.hash('hex'), input.out.hash);
|
||||
|
||||
// Transaction cannot reference itself
|
||||
if (input.out.tx.hash('hex') === this.hash('hex'))
|
||||
// Grab the previous output.
|
||||
output = input.out.tx.outputs[input.out.index];
|
||||
|
||||
// Transaction is referencing an output
|
||||
// that does not exist.
|
||||
if (!output)
|
||||
return false;
|
||||
|
||||
// Transaction cannot reference itself.
|
||||
if (input.out.hash === this.hash('hex'))
|
||||
return false;
|
||||
|
||||
return bcoin.script.verify(input.script, output.script, this, i, flags);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user