core: check stack length before returning false
verification result
We must be sure that stack has no other items before returning `false` verification result. It is an error in both cases, but by preserving the order we know exactly that it was correct `false` on stack.
This commit is contained in:
parent
f0dba26d43
commit
2ab0e6c399
1 changed files with 3 additions and 3 deletions
|
@ -1670,12 +1670,12 @@ func (bc *Blockchain) verifyHashAgainstScript(hash util.Uint160, witness *transa
|
|||
if err != nil {
|
||||
return 0, fmt.Errorf("%w: invalid return value", ErrVerificationFailed)
|
||||
}
|
||||
if !res {
|
||||
return 0, fmt.Errorf("%w: invalid signature", ErrVerificationFailed)
|
||||
}
|
||||
if vm.Estack().Len() != 0 {
|
||||
return 0, fmt.Errorf("%w: expected exactly one returned value", ErrVerificationFailed)
|
||||
}
|
||||
if !res {
|
||||
return 0, fmt.Errorf("%w: invalid signature", ErrVerificationFailed)
|
||||
}
|
||||
} else {
|
||||
return 0, fmt.Errorf("%w: no result returned from the script", ErrVerificationFailed)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue