[#42] common: Replace IRNode type and InnerRingInvoker func to ir.go file

Remove empty invoke.go source file.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
enable-notary-in-public-chains
Leonard Lyubich 2021-02-04 10:22:54 +03:00 committed by Alex Vanin
parent 0541d83cf4
commit 5d8c07b6e5
2 changed files with 17 additions and 21 deletions

View File

@ -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
}

View File

@ -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.
//