use RequiredFunds in chain inclusion balance sanity check

This commit is contained in:
vyzo 2020-08-05 13:08:07 +03:00
parent 06a13681ae
commit b4be1472c0

View File

@ -188,11 +188,13 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset *msgSet,
break
}
gasReward := mp.getGasReward(m, ts)
if gasReward.Cmp(balance) > 0 {
required := m.Message.RequiredFunds().Int
if balance.Cmp(required) < 0 {
break
}
balance = new(big.Int).Sub(balance, gasReward)
balance = new(big.Int).Sub(balance, required)
gasReward := mp.getGasReward(m, ts)
rewards = append(rewards, gasReward)
}