From 18043810c01fe949c2d701078c6625edc068a207 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 8 Jun 2021 16:07:43 +0200 Subject: [PATCH] Create MaxMessageSize constant Signed-off-by: Jakub Sztandera --- chain/messagepool/messagepool.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 78e17165f..68390885c 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -59,6 +59,8 @@ var MaxUntrustedActorPendingMessages = 10 var MaxNonceGap = uint64(4) +const MaxMessageSize = 64 << 10 // 64KiB + var ( ErrMessageTooBig = errors.New("message too big") @@ -665,7 +667,7 @@ func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Ci func (mp *MessagePool) checkMessage(m *types.SignedMessage) error { // big messages are bad, anti DOS - if m.Size() > 64*1024 { + if m.Size() > MaxMessageSize { return xerrors.Errorf("mpool message too large (%dB): %w", m.Size(), ErrMessageTooBig) }