Merge pull request #2909 from filecoin-project/fix/mpool-bug
fix mpool bugs
This commit is contained in:
commit
e65db33d77
@ -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
|
||||
}
|
||||
@ -524,7 +526,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
|
||||
|
Loading…
Reference in New Issue
Block a user