mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 23:25:22 +00:00
rpc: move NotaryRequestEvent to the subscriptions pkg
It is used for subscriptions only, so move it to the subscriptions pkg.
This commit is contained in:
parent
b3ea7504cb
commit
5c97e0dcf2
5 changed files with 19 additions and 17 deletions
|
@ -40,7 +40,7 @@ type WSClient struct {
|
|||
|
||||
// Notification represents server-generated notification for client subscriptions.
|
||||
// Value can be one of block.Block, state.AppExecResult, subscriptions.NotificationEvent
|
||||
// transaction.Transaction or response.NotaryRequestEvent based on Type.
|
||||
// transaction.Transaction or subscriptions.NotaryRequestEvent based on Type.
|
||||
type Notification struct {
|
||||
Type response.EventID
|
||||
Value interface{}
|
||||
|
@ -151,7 +151,7 @@ readloop:
|
|||
case response.ExecutionEventID:
|
||||
val = new(state.AppExecResult)
|
||||
case response.NotaryRequestEventID:
|
||||
val = new(response.NotaryRequestEvent)
|
||||
val = new(subscriptions.NotaryRequestEvent)
|
||||
case response.MissedEventID:
|
||||
// No value.
|
||||
default:
|
||||
|
|
|
@ -3,21 +3,10 @@ package response
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/mempoolevent"
|
||||
"github.com/nspcc-dev/neo-go/pkg/network/payload"
|
||||
)
|
||||
|
||||
type (
|
||||
// EventID represents an event type happening on the chain.
|
||||
EventID byte
|
||||
// NotaryRequestEvent represents P2PNotaryRequest event either added or removed
|
||||
// from notary payload pool.
|
||||
NotaryRequestEvent struct {
|
||||
Type mempoolevent.Type `json:"type"`
|
||||
NotaryRequest *payload.P2PNotaryRequest `json:"notaryrequest"`
|
||||
}
|
||||
)
|
||||
// EventID represents an event type happening on the chain.
|
||||
type EventID byte
|
||||
|
||||
const (
|
||||
// InvalidEventID is an invalid event id that is the default value of
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package subscriptions
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/mempoolevent"
|
||||
"github.com/nspcc-dev/neo-go/pkg/network/payload"
|
||||
)
|
||||
|
||||
// NotaryRequestEvent represents P2PNotaryRequest event either added or removed
|
||||
// from notary payload pool.
|
||||
type NotaryRequestEvent struct {
|
||||
Type mempoolevent.Type `json:"type"`
|
||||
NotaryRequest *payload.P2PNotaryRequest `json:"notaryrequest"`
|
||||
}
|
|
@ -1705,7 +1705,7 @@ chloop:
|
|||
resp.Payload[0] = tx
|
||||
case e := <-s.notaryRequestCh:
|
||||
resp.Event = response.NotaryRequestEventID
|
||||
resp.Payload[0] = &response.NotaryRequestEvent{
|
||||
resp.Payload[0] = &subscriptions.NotaryRequestEvent{
|
||||
Type: e.Type,
|
||||
NotaryRequest: e.Data.(*payload.P2PNotaryRequest),
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ func (f *feed) Matches(r *response.Notification) bool {
|
|||
return applog.VMState.String() == filt.State
|
||||
case response.NotaryRequestEventID:
|
||||
filt := f.filter.(request.TxFilter)
|
||||
req := r.Payload[0].(*response.NotaryRequestEvent)
|
||||
req := r.Payload[0].(*subscriptions.NotaryRequestEvent)
|
||||
senderOk := filt.Sender == nil || req.NotaryRequest.FallbackTransaction.Signers[1].Account == *filt.Sender
|
||||
signerOK := true
|
||||
if filt.Signer != nil {
|
||||
|
|
Loading…
Reference in a new issue