diff --git a/network/p2p/handler.go b/network/p2p/handler.go index d7ae86faa029..e9705050e44c 100644 --- a/network/p2p/handler.go +++ b/network/p2p/handler.go @@ -15,6 +15,8 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" ) +var _ Handler = (*NoOpHandler)(nil) + // Handler is the server-side logic for virtual machine application protocols. type Handler interface { // AppGossip is called when handling an AppGossip message. @@ -42,6 +44,20 @@ type Handler interface { ) ([]byte, error) } +type NoOpHandler struct{} + +func (NoOpHandler) AppGossip(context.Context, ids.NodeID, []byte) error { + return nil +} + +func (NoOpHandler) AppRequest(context.Context, ids.NodeID, time.Time, []byte) ([]byte, error) { + return nil, nil +} + +func (NoOpHandler) CrossChainAppRequest(context.Context, ids.ID, time.Time, []byte) ([]byte, error) { + return nil, nil +} + // responder automatically sends the response for a given request type responder struct { handlerID uint64