[#1546] morph/event: Merge notification parser and handlers

They are decoupled, but it is an error to have a handler without a
corresponding parser. Register them together on the code level and get
rid of unreachable code.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-12-06 16:01:16 +03:00 committed by Evgenii Stratonikov
parent dfa51048a8
commit d0ce835fbf
13 changed files with 44 additions and 191 deletions

View file

@ -11,15 +11,6 @@ import (
// from the StackItem list.
type NotificationParser func(*state.ContainedNotificationEvent) (Event, error)
// NotificationParserInfo is a structure that groups
// the parameters of particular contract
// notification event parser.
type NotificationParserInfo struct {
scriptHashWithType
p NotificationParser
}
// NotaryPreparator constructs NotaryEvent
// from the NotaryRequest event.
type NotaryPreparator interface {
@ -47,24 +38,6 @@ func (n *NotaryParserInfo) SetParser(p NotaryParser) {
n.p = p
}
// SetParser is an event parser setter.
func (s *NotificationParserInfo) SetParser(v NotificationParser) {
s.p = v
}
func (s NotificationParserInfo) parser() NotificationParser {
return s.p
}
// SetType is an event type setter.
func (s *NotificationParserInfo) SetType(v Type) {
s.typ = v
}
func (s NotificationParserInfo) getType() Type {
return s.typ
}
type wrongPrmNumber struct {
exp, act int
}