mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
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:
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainreg"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/labels"
|
||||
@@ -1341,22 +1340,22 @@ func testChannelFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
|
||||
// that by dave force-closing the channel. Which let's carol sweep its
|
||||
// to_remote output which is not encumbered by any relative locktime.
|
||||
ht.CloseChannelAssertPending(dave, chanPoint2, true)
|
||||
|
||||
// Mine the force close commitment transaction.
|
||||
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)
|
||||
|
||||
// We need to wait for carol initiating the sweep of the to_remote
|
||||
// output of chanPoint2.
|
||||
utxos := ht.AssertNumUTXOsUnconfirmed(carol, 1)
|
||||
utxo := ht.AssertNumUTXOsUnconfirmed(carol, 1)[0]
|
||||
|
||||
// We filter for the unconfirmed utxo and try to open a channel with
|
||||
// that utxo.
|
||||
utxoOpt := fn.Find(func(u *lnrpc.Utxo) bool {
|
||||
return u.Confirmations == 0
|
||||
}, utxos)
|
||||
fundingUtxo := utxoOpt.UnwrapOrFail(ht.T)
|
||||
// We now try to open channel using the unconfirmed utxo.
|
||||
fundingUtxo := utxo
|
||||
|
||||
// Now try to open the channel with this utxo and expect an error.
|
||||
expectedErr := fmt.Errorf("outpoint already spent or "+
|
||||
@@ -1405,6 +1404,9 @@ func testChannelFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
|
||||
ht.CloseChannelAssertPending(dave, chanPoint3, 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)
|
||||
|
||||
|
Reference in New Issue
Block a user