mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
itest+lntest: fix channel force close test
Also flatten the tests to make them easier to be maintained.
This commit is contained in:
@@ -1660,6 +1660,22 @@ func (h *HarnessTest) CleanupForceClose(hn *node.HarnessNode) {
|
||||
// Wait for the channel to be marked pending force close.
|
||||
h.AssertNumPendingForceClose(hn, 1)
|
||||
|
||||
// Mine enough blocks for the node to sweep its funds from the force
|
||||
// closed channel. The commit sweep resolver is offers the input to the
|
||||
// sweeper when it's force closed, and broadcast the sweep tx at
|
||||
// defaulCSV-1.
|
||||
//
|
||||
// NOTE: we might empty blocks here as we don't know the exact number
|
||||
// of blocks to mine. This may end up mining more blocks than needed.
|
||||
h.MineEmptyBlocks(node.DefaultCSV - 1)
|
||||
|
||||
// Assert there is one pending sweep.
|
||||
h.AssertNumPendingSweeps(hn, 1)
|
||||
|
||||
// The node should now sweep the funds, clean up by mining the sweeping
|
||||
// tx.
|
||||
h.MineBlocksAndAssertNumTxes(1, 1)
|
||||
|
||||
// Mine blocks to get any second level HTLC resolved. If there are no
|
||||
// HTLCs, this will behave like h.AssertNumPendingCloseChannels.
|
||||
h.mineTillForceCloseResolved(hn)
|
||||
@@ -2001,7 +2017,8 @@ func (h *HarnessTest) AssertSweepFound(hn *node.HarnessNode,
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("sweep tx %v not found", sweep)
|
||||
return fmt.Errorf("sweep tx %v not found in resp %v", sweep,
|
||||
sweepResp)
|
||||
}, wait.DefaultTimeout)
|
||||
require.NoError(h, err, "%s: timeout checking sweep tx", hn.Name())
|
||||
}
|
||||
|
Reference in New Issue
Block a user