mempool: Allow 0 gasPerf chains

This commit is contained in:
Łukasz Magiera 2020-08-07 14:43:32 +02:00
parent 5a50d293b9
commit 60545e6722

View File

@ -74,7 +74,7 @@ func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedM
return chains[i].Before(chains[j]) return chains[i].Before(chains[j])
}) })
if len(chains) != 0 && chains[0].gasPerf <= 0 { if len(chains) != 0 && chains[0].gasPerf < 0 {
log.Warnw("all messages in mpool have non-positive gas performance", "bestGasPerf", chains[0].gasPerf) log.Warnw("all messages in mpool have non-positive gas performance", "bestGasPerf", chains[0].gasPerf)
return nil, nil return nil, nil
} }
@ -87,14 +87,14 @@ func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedM
last := len(chains) last := len(chains)
for i, chain := range chains { for i, chain := range chains {
// does it fit in the block? // does it fit in the block?
if chain.gasLimit <= gasLimit && chain.gasPerf > 0 { if chain.gasLimit <= gasLimit && chain.gasPerf >= 0 {
gasLimit -= chain.gasLimit gasLimit -= chain.gasLimit
result = append(result, chain.msgs...) result = append(result, chain.msgs...)
continue continue
} }
// did we run out of performing chains? // did we run out of performing chains?
if chain.gasPerf <= 0 { if chain.gasPerf < 0 {
break break
} }
@ -131,14 +131,14 @@ tailLoop:
continue continue
} }
// does it fit in the bock? // does it fit in the bock?
if chain.gasLimit <= gasLimit && chain.gasPerf > 0 { if chain.gasLimit <= gasLimit && chain.gasPerf >= 0 {
gasLimit -= chain.gasLimit gasLimit -= chain.gasLimit
result = append(result, chain.msgs...) result = append(result, chain.msgs...)
continue continue
} }
// if gasPerf <= 0 we have no more profitable chains // if gasPerf < 0 we have no more profitable chains
if chain.gasPerf <= 0 { if chain.gasPerf < 0 {
break tailLoop break tailLoop
} }