Skip to content

Commit

Permalink
don't include messages that drop the balance below zero
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Oct 30, 2020
1 parent 8afceee commit 12f6119
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chain/messagepool/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,12 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
break
}
balance = new(big.Int).Sub(balance, required)
balance = new(big.Int).Sub(balance, m.Message.Value.Int)

value := m.Message.Value.Int
if balance.Cmp(value) < 0 {
break
}
balance = new(big.Int).Sub(balance, value)

gasReward := mp.getGasReward(m, baseFee)
rewards = append(rewards, gasReward)
Expand Down

0 comments on commit 12f6119

Please sign in to comment.