mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
core: rename ErrInvalidVerification and ErrInvalidInvocation
No functional changes, just a refactoring. Use more specific and meaningful names to be able to use these errors from external packages. Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
This commit is contained in:
parent
1e6372e6d9
commit
2598257628
2 changed files with 6 additions and 6 deletions
|
@ -2769,9 +2769,9 @@ var (
|
|||
ErrWitnessHashMismatch = errors.New("witness hash mismatch")
|
||||
ErrNativeContractWitness = errors.New("native contract witness must have empty verification script")
|
||||
ErrVerificationFailed = errors.New("signature check failed")
|
||||
ErrInvalidInvocation = errors.New("invalid invocation script")
|
||||
ErrInvalidInvocationScript = errors.New("invalid invocation script")
|
||||
ErrInvalidSignature = fmt.Errorf("%w: invalid signature", ErrVerificationFailed)
|
||||
ErrInvalidVerification = errors.New("invalid verification script")
|
||||
ErrInvalidVerificationScript = errors.New("invalid verification script")
|
||||
ErrUnknownVerificationContract = errors.New("unknown verification contract")
|
||||
ErrInvalidVerificationContract = errors.New("verification contract is missing `verify` method")
|
||||
)
|
||||
|
@ -2787,7 +2787,7 @@ func (bc *Blockchain) InitVerificationContext(ic *interop.Context, hash util.Uin
|
|||
}
|
||||
err := vm.IsScriptCorrect(witness.VerificationScript, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %v", ErrInvalidVerification, err) //nolint:errorlint // errorlint: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
|
||||
return fmt.Errorf("%w: %v", ErrInvalidVerificationScript, err) //nolint:errorlint // errorlint: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
|
||||
}
|
||||
ic.VM.LoadScriptWithHash(witness.VerificationScript, hash, callflag.ReadOnly)
|
||||
} else {
|
||||
|
@ -2812,7 +2812,7 @@ func (bc *Blockchain) InitVerificationContext(ic *interop.Context, hash util.Uin
|
|||
if len(witness.InvocationScript) != 0 {
|
||||
err := vm.IsScriptCorrect(witness.InvocationScript, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %v", ErrInvalidInvocation, err) //nolint:errorlint // errorlint: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
|
||||
return fmt.Errorf("%w: %v", ErrInvalidInvocationScript, err) //nolint:errorlint // errorlint: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
|
||||
}
|
||||
ic.VM.LoadScript(witness.InvocationScript)
|
||||
}
|
||||
|
|
|
@ -1293,7 +1293,7 @@ func TestBlockchain_VerifyTx(t *testing.T) {
|
|||
InvocationScript: []byte{},
|
||||
VerificationScript: verif,
|
||||
})
|
||||
checkErr(t, core.ErrInvalidVerification, tx)
|
||||
checkErr(t, core.ErrInvalidVerificationScript, tx)
|
||||
})
|
||||
t.Run("InvalidInvocationScript", func(t *testing.T) {
|
||||
tx := newTestTx(t, h, testScript)
|
||||
|
@ -1308,7 +1308,7 @@ func TestBlockchain_VerifyTx(t *testing.T) {
|
|||
InvocationScript: []byte{byte(opcode.JMP), 3, 0xff},
|
||||
VerificationScript: verif,
|
||||
})
|
||||
checkErr(t, core.ErrInvalidInvocation, tx)
|
||||
checkErr(t, core.ErrInvalidInvocationScript, tx)
|
||||
})
|
||||
t.Run("Conflict", func(t *testing.T) {
|
||||
balance := bc.GetUtilityTokenBalance(h).Int64()
|
||||
|
|
Loading…
Reference in a new issue