[#280] ir: Add netmap processor unit tests

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-04-27 17:57:27 +03:00 committed by Evgenii Stratonikov
parent fb5dcc15d2
commit d00b1c0d29
15 changed files with 690 additions and 41 deletions

View file

@ -10,24 +10,24 @@ import (
)
type AddPeer struct {
node []byte
NodeBytes []byte
// For notary notifications only.
// Contains raw transactions of notary request.
notaryRequest *payload.P2PNotaryRequest
Request *payload.P2PNotaryRequest
}
// MorphEvent implements Neo:Morph Event interface.
func (AddPeer) MorphEvent() {}
func (s AddPeer) Node() []byte {
return s.node
return s.NodeBytes
}
// NotaryRequest returns raw notary request if notification
// was received via notary service. Otherwise, returns nil.
func (s AddPeer) NotaryRequest() *payload.P2PNotaryRequest {
return s.notaryRequest
return s.Request
}
const expectedItemNumAddPeer = 1
@ -47,7 +47,7 @@ func ParseAddPeer(e *state.ContainedNotificationEvent) (event.Event, error) {
return nil, event.WrongNumberOfParameters(expectedItemNumAddPeer, ln)
}
ev.node, err = client.BytesFromStackItem(params[0])
ev.NodeBytes, err = client.BytesFromStackItem(params[0])
if err != nil {
return nil, fmt.Errorf("could not get raw nodeinfo: %w", err)
}