From 01b8a6de9444d2964ebfdcac5ba7e90d817bc8d6 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 8 Aug 2020 01:45:34 +0300 Subject: [PATCH 1/2] remove bug line --- chain/messagepool/selection.go | 1 - 1 file changed, 1 deletion(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index 592e19dc7..449ba16c4 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -524,7 +524,6 @@ func (mc *msgChain) Before(other *msgChain) bool { func (mc *msgChain) Trim(gasLimit int64, mp *MessagePool, baseFee types.BigInt, ts *types.TipSet, priority bool) { i := len(mc.msgs) - 1 for i >= 0 && (mc.gasLimit > gasLimit || (!priority && mc.gasPerf < 0)) { - gasLimit -= mc.msgs[i].Message.GasLimit gasReward := mp.getGasReward(mc.msgs[i], baseFee, ts) mc.gasReward = new(big.Int).Sub(mc.gasReward, gasReward) mc.gasLimit -= mc.msgs[i].Message.GasLimit From 4c8c8f48f159fffefa3a0af11fd2f7bd9f3b533c Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 8 Aug 2020 02:16:56 +0300 Subject: [PATCH 2/2] skip messages with nonce before the current nonce in chain creation --- chain/messagepool/selection.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index 449ba16c4..9c4b0d2e1 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -385,6 +385,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6 curNonce := a.Nonce balance := a.Balance.Int gasLimit := int64(0) + skip := 0 i := 0 rewards := make([]*big.Int, 0, len(msgs)) for i = 0; i < len(msgs); i++ { @@ -393,6 +394,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6 if m.Message.Nonce < curNonce { log.Warnf("encountered message from actor %s with nonce (%d) less than the current nonce (%d)", actor, m.Message.Nonce, curNonce) + skip++ continue } @@ -430,7 +432,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6 // check we have a sane set of messages to construct the chains if i > 0 { - msgs = msgs[:i] + msgs = msgs[skip:i] } else { return nil }