named error for too many pending messages

This commit is contained in:
vyzo 2020-08-26 22:48:03 +03:00
parent 6abfbbddd5
commit 82ef0529d8
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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: