rate limit messages per actor by enforcing maximum pending message limit
This commit is contained in:
parent
d3e95d6b77
commit
ad889a7240
@ -50,6 +50,8 @@ var RepublishInterval = pubsub.TimeCacheDuration + time.Duration(5*build.BlockDe
|
||||
|
||||
var minimumBaseFee = types.NewInt(uint64(build.MinimumBaseFee))
|
||||
|
||||
var MaxActorPendingMessages = 1000
|
||||
|
||||
var (
|
||||
ErrMessageTooBig = errors.New("message too big")
|
||||
|
||||
@ -162,6 +164,11 @@ func (ms *msgSet) add(m *types.SignedMessage, mp *MessagePool) (bool, error) {
|
||||
//ms.requiredFunds.Sub(ms.requiredFunds, exms.Message.Value.Int)
|
||||
}
|
||||
|
||||
if !has && len(ms.msgs) > MaxActorPendingMessages {
|
||||
return false, xerrors.Errorf("too many pending messages for actor in the mpool: %w",
|
||||
ErrSoftValidationFailure)
|
||||
}
|
||||
|
||||
ms.msgs[m.Message.Nonce] = m
|
||||
ms.requiredFunds.Add(ms.requiredFunds, m.Message.RequiredFunds().Int)
|
||||
//ms.requiredFunds.Add(ms.requiredFunds, m.Message.Value.Int)
|
||||
|
Loading…
Reference in New Issue
Block a user