From 79be8e66212f7cddfa0ad2f05766d6c8574a1d6c Mon Sep 17 00:00:00 2001 From: Maelkum Date: Thu, 14 Nov 2024 20:46:17 +0100 Subject: [PATCH] Fix validation --- models/execute/request.go | 4 ++-- node/process.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/execute/request.go b/models/execute/request.go index 655a2e1..dd53721 100644 --- a/models/execute/request.go +++ b/models/execute/request.go @@ -22,11 +22,11 @@ func (r Request) Valid() error { var err *multierror.Error if r.FunctionID == "" { - multierror.Append(err, errors.New("function ID is required")) + err = multierror.Append(err, errors.New("function ID is required")) } if r.Method == "" { - multierror.Append(err, errors.New("method is required")) + err = multierror.Append(err, errors.New("method is required")) } return err.ErrorOrNil() diff --git a/node/process.go b/node/process.go index ad17b32..c225a1e 100644 --- a/node/process.go +++ b/node/process.go @@ -146,12 +146,12 @@ func handleMessage[T blockless.Message](ctx context.Context, from peer.ID, paylo // If the message provides a validation mechanism - use it. type validator interface { - Validate() error + Valid() error } vmsg, ok := any(msg).(validator) if ok { - err = vmsg.Validate() + err = vmsg.Valid() if err != nil { return fmt.Errorf("rejecting message that failed validation: %w", err) }