forked from TrueCloudLab/frostfs-contract
[#42] common: Replace InvokeID function to vote.go source file
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
a9e745db18
commit
0541d83cf4
2 changed files with 10 additions and 10 deletions
|
@ -1,19 +1,9 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
|
||||
"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 {
|
||||
PublicKey []byte
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package common
|
|||
import (
|
||||
"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/crypto"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
"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 {
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue