diff --git a/chain/messagepool/repub.go b/chain/messagepool/repub.go index 1173bdb48b5..806171f52ba 100644 --- a/chain/messagepool/repub.go +++ b/chain/messagepool/repub.go @@ -67,12 +67,6 @@ func (mp *MessagePool) republishPendingMessages() error { return chains[i].Before(chains[j]) }) - // we don't republish negative performing chains; this is an error that will be screamed - // at the user - if chains[0].gasPerf < 0 { - return xerrors.Errorf("skipping republish: all message chains have negative gas performance; best gas performance: %f", chains[0].gasPerf) - } - gasLimit := int64(build.BlockGasLimit) minGas := int64(gasguess.MinGas) var msgs []*types.SignedMessage @@ -89,12 +83,6 @@ func (mp *MessagePool) republishPendingMessages() error { break } - // we don't republish negative performing chains, as they won't be included in - // a block anyway - if chain.gasPerf < 0 { - break - } - // has the chain been invalidated? if !chain.valid { i++ @@ -111,7 +99,7 @@ func (mp *MessagePool) republishPendingMessages() error { // we can't fit the current chain but there is gas to spare // trim it and push it down - chain.Trim(gasLimit, mp, baseFee, ts) + chain.Trim(gasLimit, mp, baseFee, true) for j := i; j < len(chains)-1; j++ { if chains[j].Before(chains[j+1]) { break diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index 5ba679d761a..9a1baaab48c 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -217,7 +217,7 @@ tailLoop: for gasLimit >= minGas && last < len(chains) { // trim if necessary if chains[last].gasLimit > gasLimit { - chains[last].Trim(gasLimit, mp, baseFee, ts) + chains[last].Trim(gasLimit, mp, baseFee, false) } // push down if it hasn't been invalidated @@ -284,7 +284,7 @@ tailLoop: } // dependencies fit, just trim it - chain.Trim(gasLimit-depGasLimit, mp, baseFee, ts) + chain.Trim(gasLimit-depGasLimit, mp, baseFee, false) last += i continue tailLoop } @@ -389,7 +389,7 @@ func (mp *MessagePool) selectMessagesGreedy(curTs, ts *types.TipSet) ([]*types.S tailLoop: for gasLimit >= minGas && last < len(chains) { // trim - chains[last].Trim(gasLimit, mp, baseFee, ts) + chains[last].Trim(gasLimit, mp, baseFee, false) // push down if it hasn't been invalidated if chains[last].valid { @@ -497,7 +497,7 @@ func (mp *MessagePool) selectPriorityMessages(pending map[address.Address]map[ui tailLoop: for gasLimit >= minGas && last < len(chains) { // trim, discarding negative performing messages - chains[last].Trim(gasLimit, mp, baseFee, ts) + chains[last].Trim(gasLimit, mp, baseFee, false) // push down if it hasn't been invalidated if chains[last].valid { @@ -775,9 +775,9 @@ func (mc *msgChain) Before(other *msgChain) bool { (mc.gasPerf == other.gasPerf && mc.gasReward.Cmp(other.gasReward) > 0) } -func (mc *msgChain) Trim(gasLimit int64, mp *MessagePool, baseFee types.BigInt, ts *types.TipSet) { +func (mc *msgChain) Trim(gasLimit int64, mp *MessagePool, baseFee types.BigInt, allowNegative bool) { i := len(mc.msgs) - 1 - for i >= 0 && (mc.gasLimit > gasLimit || mc.gasPerf < 0) { + for i >= 0 && (mc.gasLimit > gasLimit || (!allowNegative && mc.gasPerf < 0)) { gasReward := mp.getGasReward(mc.msgs[i], baseFee) mc.gasReward = new(big.Int).Sub(mc.gasReward, gasReward) mc.gasLimit -= mc.msgs[i].Message.GasLimit