@@ -12,7 +12,6 @@ import (
1212 "github.com/btcsuite/btcd/txscript"
1313 "github.com/btcsuite/btcd/wire"
1414 "github.com/lightningnetwork/lnd/chainreg"
15- "github.com/lightningnetwork/lnd/fn"
1615 "github.com/lightningnetwork/lnd/funding"
1716 "github.com/lightningnetwork/lnd/input"
1817 "github.com/lightningnetwork/lnd/labels"
@@ -1341,22 +1340,22 @@ func testChannelFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
13411340 // that by dave force-closing the channel. Which let's carol sweep its
13421341 // to_remote output which is not encumbered by any relative locktime.
13431342 ht .CloseChannelAssertPending (dave , chanPoint2 , true )
1343+
13441344 // Mine the force close commitment transaction.
13451345 ht .MineBlocksAndAssertNumTxes (1 , 1 )
13461346
1347+ // Make sure Carol sees her to_remote output from the force close tx.
1348+ ht .AssertNumPendingSweeps (carol , 1 )
1349+
13471350 // Mine one block to trigger the sweep transaction.
13481351 ht .MineEmptyBlocks (1 )
13491352
13501353 // We need to wait for carol initiating the sweep of the to_remote
13511354 // output of chanPoint2.
1352- utxos := ht .AssertNumUTXOsUnconfirmed (carol , 1 )
1355+ utxo := ht .AssertNumUTXOsUnconfirmed (carol , 1 )[ 0 ]
13531356
1354- // We filter for the unconfirmed utxo and try to open a channel with
1355- // that utxo.
1356- utxoOpt := fn .Find (func (u * lnrpc.Utxo ) bool {
1357- return u .Confirmations == 0
1358- }, utxos )
1359- fundingUtxo := utxoOpt .UnwrapOrFail (ht .T )
1357+ // We now try to open channel using the unconfirmed utxo.
1358+ fundingUtxo := utxo
13601359
13611360 // Now try to open the channel with this utxo and expect an error.
13621361 expectedErr := fmt .Errorf ("outpoint already spent or " +
@@ -1405,6 +1404,9 @@ func testChannelFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
14051404 ht .CloseChannelAssertPending (dave , chanPoint3 , true )
14061405 ht .MineBlocksAndAssertNumTxes (1 , 1 )
14071406
1407+ // Make sure Carol sees her to_remote output from the force close tx.
1408+ ht .AssertNumPendingSweeps (carol , 1 )
1409+
14081410 // Mine one block to trigger the sweep transaction.
14091411 ht .MineEmptyBlocks (1 )
14101412
0 commit comments