fix: mempool: check messages against the next block's height

Previously, we checked message gas/validity with the previous block's
height. This doesn't affect consensus, but will help us avoid adding
messages to the message pool that shouldn't be there.
This commit is contained in:
Steven Allen 2022-02-21 14:39:11 +00:00
parent 04bc4405c7
commit 1234fcfd4f
2 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ func (mp *MessagePool) checkMessages(ctx context.Context, msgs []*types.Message,
curTs := mp.curTs
mp.curTsLk.Unlock()
epoch := curTs.Height()
epoch := curTs.Height() + 1
var baseFee big.Int
if len(curTs.Blocks()) > 0 {

View File

@ -628,7 +628,7 @@ func (mp *MessagePool) addLocal(ctx context.Context, m *types.SignedMessage) err
// For non local messages, if the message cannot be included in the next 20 blocks it returns
// a (soft) validation error.
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
epoch := curTs.Height()
epoch := curTs.Height() + 1
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), build.NewestNetworkVersion); err != nil {