itest: remove redundant block in multiple tests

This commit is contained in:
yyforyongyu 2024-10-25 14:05:55 +08:00
parent 9c0c373b7e
commit 425877e745
No known key found for this signature in database
GPG key ID: 9BCD95C4FF296868
3 changed files with 15 additions and 9 deletions

View file

@ -1320,12 +1320,20 @@ func testDataLossProtection(ht *lntest.HarnessTest) {
// information Dave needs to sweep his funds.
require.NoError(ht, restartDave(), "unable to restart Eve")
// Mine a block to trigger Dave's chain watcher to process Carol's sweep
// tx.
//
// TODO(yy): remove this block once the blockbeat starts remembering
// its last processed block and can handle looking for spends in the
// past blocks.
ht.MineEmptyBlocks(1)
// Make sure Dave still has the pending force close channel.
ht.AssertNumPendingForceClose(dave, 1)
// Dave should have a pending sweep.
ht.AssertNumPendingSweeps(dave, 1)
// Mine a block to trigger the sweep.
ht.MineBlocks(1)
// Dave should sweep his funds.
ht.AssertNumTxsInMempool(1)

View file

@ -832,7 +832,6 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
// we've already mined 1 block so we need one less than our CSV.
ht.MineBlocks(node.DefaultCSV - 1)
ht.AssertNumPendingSweeps(ht.Bob, 1)
ht.MineEmptyBlocks(1)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Restart bob so that we can test that he's able to recover everything
@ -852,6 +851,7 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
ht.AssertNumPendingSweeps(ht.Bob, 0)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Assert that the HTLC has cleared.
ht.AssertHTLCNotActive(ht.Bob, testCase.channels[0], hash[:])
ht.AssertHTLCNotActive(ht.Alice, testCase.channels[0], hash[:])
@ -866,8 +866,9 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
)
// Clean up the rest of our force close: mine blocks so that Bob's CSV
// expires plus one block to trigger his sweep and then mine it.
ht.MineBlocks(node.DefaultCSV + 1)
// expires to trigger his sweep and then mine it.
ht.MineBlocks(node.DefaultCSV)
ht.AssertNumPendingSweeps(ht.Bob, 1)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Bring carol back up so that we can close out the rest of our

View file

@ -117,9 +117,6 @@ func testWipeForwardingPackages(ht *lntest.HarnessTest) {
// Alice should one pending sweep.
ht.AssertNumPendingSweeps(alice, 1)
// Mine a block to trigger the sweep.
ht.MineBlocks(1)
// Mine 1 block to get Alice's sweeping tx confirmed.
ht.MineBlocksAndAssertNumTxes(1, 1)