Skip to content

Commit

Permalink
test: Remove recheck related codes
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jan 21, 2025
1 parent 3b84167 commit e1c49a7
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions mempool/clist_mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ func TestMempoolUpdateDoesNotPanicWhenApplicationMissedTx(t *testing.T) {
}
time.Sleep(10 * time.Millisecond)
require.Len(t, txs, mp.Size())
require.True(t, mp.recheck.done())

// Calling update to remove the first transaction from the mempool.
// This call also triggers the mempool to recheck its remaining transactions.
Expand Down Expand Up @@ -931,11 +930,6 @@ func TestMempoolAsyncRecheckTxReturnError(t *testing.T) {
// The 4 txs are added to the mempool.
require.Len(t, txs, mp.Size())

// Check that recheck has not started.
require.True(t, mp.recheck.done())
require.Nil(t, mp.recheck.cursor)
require.Nil(t, mp.recheck.end)
require.False(t, mp.recheck.isRechecking.Load())
mockClient.AssertExpectations(t)

// One call to CheckTxAsync per tx, for rechecking.
Expand All @@ -960,15 +954,8 @@ func TestMempoolAsyncRecheckTxReturnError(t *testing.T) {
callback(reqRes2.Request, reqRes2.Response)
}).Return(nil)

// mp.recheck.done() should be true only before and after calling recheckTxs.
mp.recheckTxs()
require.True(t, mp.recheck.done())
require.False(t, mp.recheck.isRechecking.Load())
require.Nil(t, mp.recheck.cursor)
require.NotNil(t, mp.recheck.end)
require.Equal(t, mp.recheck.end, mp.txs.Back())
require.Equal(t, len(txs)-1, mp.Size()) // one invalid tx was removed
require.Equal(t, int32(2), mp.recheck.numPendingTxs.Load())

mockClient.AssertExpectations(t)
}
Expand All @@ -989,15 +976,10 @@ func TestMempoolRecheckRace(t *testing.T) {
// Update one transaction to force rechecking the rest.
doUpdate(t, mp, 1, txs[:1])

// Recheck has finished
require.True(t, mp.recheck.done())
require.Nil(t, mp.recheck.cursor)

// Add again the same transaction that was updated. Recheck has finished so adding this tx
// should not result in a data race on the variable recheck.cursor.
_, err = mp.CheckTxSync(txs[:1][0], nil, TxInfo{})
require.Equal(t, err, ErrTxInCache)
require.Zero(t, mp.recheck.numPendingTxs.Load())
}

// Test adding transactions while a concurrent routine reaps txs and updates the mempool, simulating
Expand Down

0 comments on commit e1c49a7

Please sign in to comment.