mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 03:58:06 +00:00
core: add tests for (*Blockchain).verifyHashAgainstScript
This commit is contained in:
parent
1eb9a4c6c6
commit
cadebdfc19
1 changed files with 18 additions and 0 deletions
|
@ -335,6 +335,24 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
||||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
t.Run("NotEnoughGas", func(t *testing.T) {
|
||||||
|
verif := []byte{byte(opcode.PUSH1)}
|
||||||
|
w := &transaction.Witness{
|
||||||
|
InvocationScript: []byte{byte(opcode.NOP)},
|
||||||
|
VerificationScript: verif,
|
||||||
|
}
|
||||||
|
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, 1)
|
||||||
|
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||||
|
})
|
||||||
|
t.Run("NoResult", func(t *testing.T) {
|
||||||
|
verif := []byte{byte(opcode.DROP)}
|
||||||
|
w := &transaction.Witness{
|
||||||
|
InvocationScript: []byte{byte(opcode.PUSH1)},
|
||||||
|
VerificationScript: verif,
|
||||||
|
}
|
||||||
|
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, gas)
|
||||||
|
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHasBlock(t *testing.T) {
|
func TestHasBlock(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue