From 99dfb8df68a2548df47cb76afa1b575b42caf87a Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 3 Dec 2019 22:18:02 -0800 Subject: [PATCH] dont add too many messages to a block --- miner/miner.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miner/miner.go b/miner/miner.go index 0b8d2f9f5..df2b3cdaa 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -17,6 +17,8 @@ import ( "golang.org/x/xerrors" ) +const MaxMessagesPerBlock = 4000 + var log = logging.Logger("miner") type waitFunc func(ctx context.Context, baseTime uint64) error @@ -424,6 +426,9 @@ func selectMessages(ctx context.Context, al actorLookup, base *MiningBase, msgs inclCount[from]++ out = append(out, msg) + if len(out) >= MaxMessagesPerBlock { + break + } } return out, nil }