lntest: mine empty blocks when cleaning up force close

Fix this test flake,
```
harness_miner.go:218:
        	Error Trace:	/home/runner/work/lnd/lnd/lntest/harness_miner.go:218
        	            				/home/runner/work/lnd/lnd/lntest/harness.go:1641
        	            				/home/runner/work/lnd/lnd/lntest/harness.go:1515
        	            				/home/runner/work/lnd/lnd/itest/lnd_wipe_fwdpkgs_test.go:121
        	            				/home/runner/work/lnd/lnd/lntest/harness.go:286
        	            				/home/runner/work/lnd/lnd/itest/lnd_test.go:136
        	Error:      	Received unexpected error:
        	            	want 1, got 0 in mempool: []
        	Test:       	TestLightningNetworkDaemon/tranche02/91-of-135/neutrino/wipe_forwarding_packages
        	Messages:   	assert tx in mempool timeout
    harness.go:339: finished test: wipe_forwarding_packages, start height=1636, end height=1653, mined blocks=17
    harness.go:345: test failed, skipped cleanup
```
This commit is contained in:
yyforyongyu 2023-10-31 16:51:24 +08:00
parent 2caa7d2b2b
commit cc6b20bf2f
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -1504,11 +1504,13 @@ func (h *HarnessTest) CleanupForceClose(hn *node.HarnessNode) {
h.AssertNumPendingForceClose(hn, 1)
// Mine enough blocks for the node to sweep its funds from the force
// closed channel.
// closed channel. The commit sweep resolver is able to broadcast the
// sweep tx up to one block before the CSV elapses, so wait until
// defaulCSV-1.
//
// The commit sweep resolver is able to broadcast the sweep tx up to
// one block before the CSV elapses, so wait until defaulCSV-1.
h.MineBlocks(node.DefaultCSV - 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)
// The node should now sweep the funds, clean up by mining the sweeping
// tx.