From 5e2a81ad03f86b92ad65595ab131367b3f5b94c6 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 5 May 2022 15:31:45 +0300 Subject: [PATCH] interop: fix the signature of Neo's GetCandidates interop API --- pkg/interop/native/neo/neo.go | 7 ++++--- pkg/interop/native/neo/neo_candidate.go | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 pkg/interop/native/neo/neo_candidate.go diff --git a/pkg/interop/native/neo/neo.go b/pkg/interop/native/neo/neo.go index fbed674c3..f14a17799 100644 --- a/pkg/interop/native/neo/neo.go +++ b/pkg/interop/native/neo/neo.go @@ -53,9 +53,10 @@ func GetCommittee() []interop.PublicKey { return neogointernal.CallWithToken(Hash, "getCommittee", int(contract.ReadStates)).([]interop.PublicKey) } -// GetCandidates represents `getCandidates` method of NEO native contract. -func GetCandidates() []interop.PublicKey { - return neogointernal.CallWithToken(Hash, "getCandidates", int(contract.ReadStates)).([]interop.PublicKey) +// GetCandidates represents `getCandidates` method of NEO native contract. It +// returns up to 256 candidates. +func GetCandidates() []Candidate { + return neogointernal.CallWithToken(Hash, "getCandidates", int(contract.ReadStates)).([]Candidate) } // GetNextBlockValidators represents `getNextBlockValidators` method of NEO native contract. diff --git a/pkg/interop/native/neo/neo_candidate.go b/pkg/interop/native/neo/neo_candidate.go new file mode 100644 index 000000000..7d9dc0313 --- /dev/null +++ b/pkg/interop/native/neo/neo_candidate.go @@ -0,0 +1,9 @@ +package neo + +import "github.com/nspcc-dev/neo-go/pkg/interop" + +// Candidate represents a single native Neo candidate. +type Candidate struct { + Key interop.PublicKey + Votes int +}