From 5d8c07b6e5a68ff0ba460252766fbe0e2a1a9774 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 4 Feb 2021 10:22:54 +0300 Subject: [PATCH] [#42] common: Replace IRNode type and InnerRingInvoker func to ir.go file Remove empty invoke.go source file. Signed-off-by: Leonard Lyubich --- common/invoke.go | 21 --------------------- common/ir.go | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 common/invoke.go diff --git a/common/invoke.go b/common/invoke.go deleted file mode 100644 index 194405d..0000000 --- a/common/invoke.go +++ /dev/null @@ -1,21 +0,0 @@ -package common - -import ( - "github.com/nspcc-dev/neo-go/pkg/interop/runtime" -) - -type IRNode struct { - PublicKey []byte -} - -// InnerRingInvoker returns public key of inner ring node that invoked contract. -func InnerRingInvoker(ir []IRNode) []byte { - for i := 0; i < len(ir); i++ { - node := ir[i] - if runtime.CheckWitness(node.PublicKey) { - return node.PublicKey - } - } - - return nil -} diff --git a/common/ir.go b/common/ir.go index 41e7689..f0e35da 100644 --- a/common/ir.go +++ b/common/ir.go @@ -3,11 +3,28 @@ package common import ( "github.com/nspcc-dev/neo-go/pkg/interop" "github.com/nspcc-dev/neo-go/pkg/interop/contract" + "github.com/nspcc-dev/neo-go/pkg/interop/runtime" "github.com/nspcc-dev/neo-go/pkg/interop/storage" ) const irListMethod = "innerRingList" +type IRNode struct { + PublicKey []byte +} + +// InnerRingInvoker returns public key of inner ring node that invoked contract. +func InnerRingInvoker(ir []IRNode) []byte { + for i := 0; i < len(ir); i++ { + node := ir[i] + if runtime.CheckWitness(node.PublicKey) { + return node.PublicKey + } + } + + return nil +} + // InnerRingList returns list of inner ring nodes through calling // "innerRingList" method of smart contract. //