From b3c25b5a1f01e774cddc468c56929a6e606cfa6b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 22 Jul 2022 21:26:29 +0300 Subject: [PATCH] neorpc/result: move NotaryRequestEvent to this package Not worth a package of its own. --- pkg/neorpc/result/{subscriptions => }/notary_request_event.go | 2 +- pkg/rpcclient/wsclient.go | 4 ++-- pkg/services/rpcsrv/server.go | 3 +-- pkg/services/rpcsrv/subscription.go | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) rename pkg/neorpc/result/{subscriptions => }/notary_request_event.go (94%) diff --git a/pkg/neorpc/result/subscriptions/notary_request_event.go b/pkg/neorpc/result/notary_request_event.go similarity index 94% rename from pkg/neorpc/result/subscriptions/notary_request_event.go rename to pkg/neorpc/result/notary_request_event.go index f1cd35daa..030968a12 100644 --- a/pkg/neorpc/result/subscriptions/notary_request_event.go +++ b/pkg/neorpc/result/notary_request_event.go @@ -1,4 +1,4 @@ -package subscriptions +package result import ( "github.com/nspcc-dev/neo-go/pkg/core/mempoolevent" diff --git a/pkg/rpcclient/wsclient.go b/pkg/rpcclient/wsclient.go index ad8915580..ab77f141d 100644 --- a/pkg/rpcclient/wsclient.go +++ b/pkg/rpcclient/wsclient.go @@ -14,7 +14,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc" - "github.com/nspcc-dev/neo-go/pkg/neorpc/result/subscriptions" + "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/util" "go.uber.org/atomic" ) @@ -186,7 +186,7 @@ readloop: case neorpc.ExecutionEventID: val = new(state.AppExecResult) case neorpc.NotaryRequestEventID: - val = new(subscriptions.NotaryRequestEvent) + val = new(result.NotaryRequestEvent) case neorpc.MissedEventID: // No value. default: diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index bc9b36951..c0ae35b69 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -41,7 +41,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/neorpc" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" - "github.com/nspcc-dev/neo-go/pkg/neorpc/result/subscriptions" "github.com/nspcc-dev/neo-go/pkg/network" "github.com/nspcc-dev/neo-go/pkg/network/payload" "github.com/nspcc-dev/neo-go/pkg/services/oracle" @@ -2514,7 +2513,7 @@ chloop: resp.Payload[0] = tx case e := <-s.notaryRequestCh: resp.Event = neorpc.NotaryRequestEventID - resp.Payload[0] = &subscriptions.NotaryRequestEvent{ + resp.Payload[0] = &result.NotaryRequestEvent{ Type: e.Type, NotaryRequest: e.Data.(*payload.P2PNotaryRequest), } diff --git a/pkg/services/rpcsrv/subscription.go b/pkg/services/rpcsrv/subscription.go index dec18b223..6ec1be3fb 100644 --- a/pkg/services/rpcsrv/subscription.go +++ b/pkg/services/rpcsrv/subscription.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc" - "github.com/nspcc-dev/neo-go/pkg/neorpc/result/subscriptions" + "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "go.uber.org/atomic" ) @@ -82,7 +82,7 @@ func (f *feed) Matches(r *neorpc.Notification) bool { return applog.VMState.String() == filt.State case neorpc.NotaryRequestEventID: filt := f.filter.(neorpc.TxFilter) - req := r.Payload[0].(*subscriptions.NotaryRequestEvent) + req := r.Payload[0].(*result.NotaryRequestEvent) senderOk := filt.Sender == nil || req.NotaryRequest.FallbackTransaction.Signers[1].Account == *filt.Sender signerOK := true if filt.Signer != nil {