mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
parent
63bb36ca12
commit
26339c75dc
4 changed files with 23 additions and 93 deletions
|
@ -394,22 +394,22 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
|||
newH := cs.ScriptHash()
|
||||
newH[0] = ^newH[0]
|
||||
w := &transaction.Witness{InvocationScript: []byte{byte(opcode.PUSH4)}}
|
||||
err := bc.verifyHashAgainstScript(newH, w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(newH, w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrUnknownVerificationContract))
|
||||
})
|
||||
t.Run("Invalid", func(t *testing.T) {
|
||||
w := &transaction.Witness{InvocationScript: []byte{byte(opcode.PUSH4)}}
|
||||
err := bc.verifyHashAgainstScript(csInvalid.ScriptHash(), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(csInvalid.ScriptHash(), w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrInvalidVerificationContract))
|
||||
})
|
||||
t.Run("ValidSignature", func(t *testing.T) {
|
||||
w := &transaction.Witness{InvocationScript: []byte{byte(opcode.PUSH4)}}
|
||||
err := bc.verifyHashAgainstScript(cs.ScriptHash(), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(cs.ScriptHash(), w, ic, gas)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
t.Run("InvalidSignature", func(t *testing.T) {
|
||||
w := &transaction.Witness{InvocationScript: []byte{byte(opcode.PUSH3)}}
|
||||
err := bc.verifyHashAgainstScript(cs.ScriptHash(), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(cs.ScriptHash(), w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||
})
|
||||
})
|
||||
|
@ -419,7 +419,7 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
|||
InvocationScript: []byte{byte(opcode.NOP)},
|
||||
VerificationScript: verif,
|
||||
}
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, 1)
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, 1)
|
||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||
})
|
||||
t.Run("NoResult", func(t *testing.T) {
|
||||
|
@ -428,7 +428,7 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
|||
InvocationScript: []byte{byte(opcode.PUSH1)},
|
||||
VerificationScript: verif,
|
||||
}
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||
})
|
||||
t.Run("BadResult", func(t *testing.T) {
|
||||
|
@ -439,7 +439,7 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
|||
InvocationScript: []byte{byte(opcode.NOP)},
|
||||
VerificationScript: verif,
|
||||
}
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||
})
|
||||
t.Run("TooManyResults", func(t *testing.T) {
|
||||
|
@ -448,7 +448,7 @@ func TestVerifyHashAgainstScript(t *testing.T) {
|
|||
InvocationScript: []byte{byte(opcode.PUSH1), byte(opcode.PUSH1)},
|
||||
VerificationScript: verif,
|
||||
}
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, false, gas)
|
||||
err := bc.verifyHashAgainstScript(hash.Hash160(verif), w, ic, gas)
|
||||
require.True(t, errors.Is(err, ErrVerificationFailed))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue