[#42] common: Replace InvokeID function to vote.go source file

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-04 10:20:07 +03:00 committed by Alex Vanin
parent a9e745db18
commit 0541d83cf4
2 changed files with 10 additions and 10 deletions

View file

@ -1,19 +1,9 @@
package common package common
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime" "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
) )
func InvokeID(args []interface{}, prefix []byte) []byte {
for i := range args {
arg := args[i].([]byte)
prefix = append(prefix, arg...)
}
return crypto.SHA256(prefix)
}
type IRNode struct { type IRNode struct {
PublicKey []byte PublicKey []byte
} }

View file

@ -3,6 +3,7 @@ package common
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary" "github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/blockchain" "github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/storage" "github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util" "github.com/nspcc-dev/neo-go/pkg/interop/util"
) )
@ -107,3 +108,12 @@ func getBallots(ctx storage.Context) []Ballot {
func BytesEqual(a []byte, b []byte) bool { func BytesEqual(a []byte, b []byte) bool {
return util.Equals(string(a), string(b)) return util.Equals(string(a), string(b))
} }
func InvokeID(args []interface{}, prefix []byte) []byte {
for i := range args {
arg := args[i].([]byte)
prefix = append(prefix, arg...)
}
return crypto.SHA256(prefix)
}