From 6a44b80c8646a6baf36b184f3768b16e50588c96 Mon Sep 17 00:00:00 2001 From: Paladz Date: Thu, 29 Oct 2020 21:53:34 +0800 Subject: [PATCH] add_soft_limit for max_tx per block (#555) Co-authored-by: paladz --- proposal/proposal.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proposal/proposal.go b/proposal/proposal.go index 2832c9b0..93814028 100644 --- a/proposal/proposal.go +++ b/proposal/proposal.go @@ -22,6 +22,7 @@ import ( const ( logModule = "mining" batchApplyNum = 64 + softMaxTxNum = 128 timeoutOk = iota + 1 timeoutWarn @@ -119,7 +120,7 @@ func (b *blockBuilder) applyTransactions(txs []*types.Tx, timeoutStatus uint8) e b.gasLeft = gasLeft tempTxs = []*types.Tx{} - if b.getTimeoutStatus() >= timeoutStatus { + if b.getTimeoutStatus() >= timeoutStatus || len(b.block.Transactions) > softMaxTxNum { break } } -- 2.11.0