github.com/koko1123/flow-go-1@v0.29.6/network/slashing/violations_consumer.go (about) 1 package slashing 2 3 import ( 4 "github.com/koko1123/flow-go-1/model/flow" 5 network "github.com/koko1123/flow-go-1/network/channels" 6 "github.com/koko1123/flow-go-1/network/message" 7 ) 8 9 type ViolationsConsumer interface { 10 // OnUnAuthorizedSenderError logs an error for unauthorized sender error 11 OnUnAuthorizedSenderError(violation *Violation) 12 13 // OnUnknownMsgTypeError logs an error for unknown message type error 14 OnUnknownMsgTypeError(violation *Violation) 15 16 // OnInvalidMsgError logs an error for messages that contained payloads that could not 17 // be unmarshalled into the message type denoted by message code byte. 18 OnInvalidMsgError(violation *Violation) 19 20 // OnSenderEjectedError logs an error for sender ejected error 21 OnSenderEjectedError(violation *Violation) 22 23 // OnUnauthorizedUnicastOnChannel logs an error for messages unauthorized to be sent via unicast 24 OnUnauthorizedUnicastOnChannel(violation *Violation) 25 26 // OnUnexpectedError logs an error for unknown errors 27 OnUnexpectedError(violation *Violation) 28 } 29 30 type Violation struct { 31 Identity *flow.Identity 32 PeerID string 33 MsgType string 34 Channel network.Channel 35 Protocol message.Protocol 36 Err error 37 }