Skip to content

Commit

Permalink
itest: remove redundant block in multiple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yyforyongyu committed Dec 13, 2024
1 parent d0033fc commit c103abb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 11 additions & 3 deletions itest/lnd_channel_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 4 additions & 3 deletions itest/lnd_route_blinding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[:])

Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions itest/lnd_wipe_fwdpkgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c103abb

Please sign in to comment.