lntest+itest: fix flakes found using neutrino backend

This commit makes sure the sweep requests are received before mining
blocks to trigger the actual sweeping.

In addition, `testFundingExpiryBlocksOnPending` is updated to deal with
the old `channel link not found` issue.
This commit is contained in:
yyforyongyu
2024-07-16 01:53:59 +08:00
parent 2608c0893e
commit 4dcce9df69
5 changed files with 43 additions and 19 deletions

View File

@@ -1683,6 +1683,9 @@ func testPsbtChanFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
ht.CloseChannelAssertPending(dave, channelPoint, true)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Make sure Carol sees her to_remote output from the force close tx.
ht.AssertNumPendingSweeps(carol, 1)
// Mine one block to trigger the sweep transaction.
ht.MineEmptyBlocks(1)
@@ -1805,6 +1808,9 @@ func testPsbtChanFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
ht.CloseChannelAssertPending(dave, channelPoint2, true)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Make sure Carol sees her to_remote output from the force close tx.
ht.AssertNumPendingSweeps(carol, 1)
// Mine one block to trigger the sweep transaction.
ht.MineEmptyBlocks(1)
@@ -1929,12 +1935,6 @@ func testPsbtChanFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
updateResp = ht.ReceiveOpenChannelUpdate(chanUpdates)
upd, ok = updateResp.Update.(*lnrpc.OpenStatusUpdate_ChanPending)
require.True(ht, ok)
channelPoint3 := &lnrpc.ChannelPoint{
FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{
FundingTxidBytes: upd.ChanPending.Txid,
},
OutputIndex: upd.ChanPending.OutputIndex,
}
err = finalTx.Deserialize(bytes.NewReader(finalizeRes.RawFinalTx))
require.NoError(ht, err)
@@ -1942,6 +1942,4 @@ func testPsbtChanFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
txHash = finalTx.TxHash()
block = ht.MineBlocksAndAssertNumTxes(1, 1)[0]
ht.AssertTxInBlock(block, &txHash)
ht.CloseChannel(carol, channelPoint3)
}