diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 50f64f903ab..6dc3f223988 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -63,6 +63,9 @@ var MaxNonceGap = uint64(4) const MaxMessageSize = 64 << 10 // 64KiB +// NOTE: When adding a new error type, please make sure to add the new error type in +// func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) +// in /chain/sub/incoming.go var ( ErrMessageTooBig = errors.New("message too big") diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index a7c0bee57d9..fc2b7baffcb 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -350,6 +350,7 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs ) recordFailure(ctx, metrics.MessageValidationFailure, "add") switch { + case xerrors.Is(err, messagepool.ErrSoftValidationFailure): fallthrough case xerrors.Is(err, messagepool.ErrRBFTooLowPremium): @@ -362,8 +363,17 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs fallthrough case xerrors.Is(err, messagepool.ErrNonceTooLow): fallthrough + case xerrors.Is(err, messagepool.ErrNotEnoughFunds): + fallthrough case xerrors.Is(err, messagepool.ErrExistingNonce): return pubsub.ValidationIgnore + + case xerrors.Is(err, messagepool.ErrMessageTooBig): + fallthrough + case xerrors.Is(err, messagepool.ErrMessageValueTooHigh): + fallthrough + case xerrors.Is(err, messagepool.ErrInvalidToAddr): + fallthrough default: return pubsub.ValidationReject }