From 82ef0529d810d0fe241dfe4d634d01a0d4320d5a Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 26 Aug 2020 22:48:03 +0300 Subject: [PATCH] named error for too many pending messages --- chain/messagepool/messagepool.go | 8 ++++---- chain/sub/incoming.go | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 8a4229da5..51a847472 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -65,8 +65,9 @@ var ( ErrInvalidToAddr = errors.New("message had invalid to address") - ErrSoftValidationFailure = errors.New("validation failure") - ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") + ErrSoftValidationFailure = errors.New("validation failure") + ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") + ErrTooManyPendingMessages = errors.New("too many pending messages for actor") ErrTryAgain = errors.New("state inconsistency while pushing message; please try again") ) @@ -165,8 +166,7 @@ func (ms *msgSet) add(m *types.SignedMessage, mp *MessagePool) (bool, error) { } if !has && len(ms.msgs) > MaxActorPendingMessages { - return false, xerrors.Errorf("too many pending messages for actor in the mpool: %w", - ErrSoftValidationFailure) + return false, ErrTooManyPendingMessages } ms.msgs[m.Message.Nonce] = m diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index e176361ec..5d14be088 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -549,6 +549,8 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs fallthrough case xerrors.Is(err, messagepool.ErrRBFTooLowPremium): fallthrough + case xerrors.Is(err, messagepool.ErrTooManyPendingMessages): + fallthrough case xerrors.Is(err, messagepool.ErrNonceTooLow): return pubsub.ValidationIgnore default: