From 2efb18f6775bd32e6370bed29ba98b91df0ff7ee Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 11 Aug 2020 23:55:06 +0200 Subject: [PATCH] Small fixes to mpool Trim Signed-off-by: Jakub Sztandera --- chain/messagepool/selection.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index bed084aad..7bfaaf811 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -811,12 +811,15 @@ func (mc *msgChain) Trim(gasLimit int64, mp *MessagePool, baseFee types.BigInt, mc.gasLimit -= mc.msgs[i].Message.GasLimit if mc.gasLimit > 0 { bp := 1.0 - if mc.effPerf != 0 { + if mc.gasPerf != 0 { // prevent div by 0 bp = mc.effPerf / mc.gasPerf } mc.gasPerf = mp.getGasPerf(mc.gasReward, mc.gasLimit) - mc.effPerf = bp * mc.gasPerf + + if mc.effPerf != 0 { // keep effPerf 0 if it is 0 + mc.effPerf = bp * mc.gasPerf + } } else { mc.gasPerf = 0 }