neo-go/pkg/core/interop/crypto/interop.go
Evgenii Stratonikov 941410a840 core: change verification scripts to new format
Verification scripts now invoke Neo.Crypto.* interops instead of
CHECKSIG/VERIFY opcodes.
2020-04-20 11:55:24 +03:00

34 lines
836 B
Go

package crypto
import (
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/vm"
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
)
var (
ecdsaVerifyID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify"))
ecdsaCheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig"))
)
// GetInterop returns interop getter for crypto-related stuff.
func GetInterop(ic *interop.Context) func(uint32) *vm.InteropFuncPrice {
return func(id uint32) *vm.InteropFuncPrice {
switch id {
case ecdsaVerifyID:
return &vm.InteropFuncPrice{
Func: func(v *vm.VM) error {
return ECDSAVerify(ic, v)
},
}
case ecdsaCheckMultisigID:
return &vm.InteropFuncPrice{
Func: func(v *vm.VM) error {
return ECDSACheckMultisig(ic, v)
},
}
default:
return nil
}
}
}