From f53d2e3a4653a806d3dde839ed104b41007f4af1 Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 2 Sep 2020 00:12:43 +0300 Subject: [PATCH] cap MaxNonceGap to 16 --- chain/messagepool/messagepool.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 951c74a2c..556c20198 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -53,7 +53,7 @@ var minimumBaseFee = types.NewInt(uint64(build.MinimumBaseFee)) var MaxActorPendingMessages = 1000 -var MaxNonceGap = uint64(runtime.NumCPU()) +var MaxNonceGap = uint64(16) var ( ErrMessageTooBig = errors.New("message too big") @@ -82,6 +82,13 @@ const ( localUpdates = "update" ) +func init() { + numcpus := uint64(runtime.NumCPU()) + if numcpus < MaxNonceGap { + MaxNonceGap = numcpus + } +} + type MessagePool struct { lk sync.Mutex