From 12f61197394a44b1779c68eba2322e26b831726e Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 30 Oct 2020 20:56:33 +0200 Subject: [PATCH] don't include messages that drop the balance below zero --- chain/messagepool/selection.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index d79ed9f553e..5a8200bf8c7 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -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)