diff --git a/itest/flakes.go b/itest/flakes.go index 612c6bba2..e502fcd91 100644 --- a/itest/flakes.go +++ b/itest/flakes.go @@ -3,7 +3,9 @@ package itest import ( "time" + "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" ) // flakePreimageSettlement documents a flake found when testing the preimage @@ -31,3 +33,16 @@ func flakePreimageSettlement(ht *lntest.HarnessTest) { // would cause the sweeper to RBF it. time.Sleep(2 * time.Second) } + +// flakeFundExtraUTXO documents a flake found when testing the sweeping behavior +// of the given node, which would fail due to no wallet UTXO available, while +// there should be enough. +// +// TODO(yy): remove it once the issue is resolved. +func flakeFundExtraUTXO(ht *lntest.HarnessTest, node *node.HarnessNode) { + // The node should have enough wallet UTXOs here to sweep the HTLC in + // the end of this test. However, due to a known issue, the node's + // wallet may report there's no UTXO available. For details, + // - https://github.com/lightningnetwork/lnd/issues/8786 + ht.FundCoins(btcutil.SatoshiPerBitcoin, node) +} diff --git a/itest/lnd_multi-hop_force_close_test.go b/itest/lnd_multi-hop_force_close_test.go index 70654e115..63e380222 100644 --- a/itest/lnd_multi-hop_force_close_test.go +++ b/itest/lnd_multi-hop_force_close_test.go @@ -341,13 +341,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest, ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) } - // Bob should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Bob's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + flakeFundExtraUTXO(ht, bob) // Now that our channels are set up, we'll send two HTLC's from Alice // to Carol. The first HTLC will be universally considered "dust", @@ -707,14 +701,7 @@ func runMultiHopReceiverPreimageClaim(ht *lntest.HarnessTest, // Fund Carol one UTXO so she can sweep outputs. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Carol should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Carol's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) + flakeFundExtraUTXO(ht, carol) // If this is a taproot channel, then we'll need to make some manual // route hints so Alice can actually find a route. @@ -1656,22 +1643,8 @@ func runLocalClaimIncomingHTLC(ht *lntest.HarnessTest, // Fund Carol one UTXO so she can sweep outputs. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Carol should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Carol's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Bob should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Bob's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + flakeFundExtraUTXO(ht, carol) + flakeFundExtraUTXO(ht, bob) // If this is a taproot channel, then we'll need to make some manual // route hints so Alice can actually find a route. @@ -1978,14 +1951,7 @@ func runLocalClaimIncomingHTLCLeased(ht *lntest.HarnessTest, // Fund Carol one UTXO so she can sweep outputs. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Carol should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Carol's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) + flakeFundExtraUTXO(ht, carol) // With the network active, we'll now add a new hodl invoice at Carol's // end. Make sure the cltv expiry delta is large enough, otherwise Bob @@ -2314,14 +2280,7 @@ func runLocalPreimageClaim(ht *lntest.HarnessTest, // Fund Carol one UTXO so she can sweep outputs. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Carol should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Carol's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) + flakeFundExtraUTXO(ht, carol) // If this is a taproot channel, then we'll need to make some manual // route hints so Alice can actually find a route. @@ -2621,14 +2580,7 @@ func runLocalPreimageClaimLeased(ht *lntest.HarnessTest, // Fund Carol one UTXO so she can sweep outputs. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - - // Carol should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Carol's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) + flakeFundExtraUTXO(ht, carol) // With the network active, we'll now add a new hodl invoice at Carol's // end. Make sure the cltv expiry delta is large enough, otherwise Bob @@ -2992,14 +2944,7 @@ func runHtlcAggregation(ht *lntest.HarnessTest, // We need one additional UTXO to create the sweeping tx for the // second-level success txes. ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) - - // Bob should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Bob's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + flakeFundExtraUTXO(ht, bob) // If this is a taproot channel, then we'll need to make some manual // route hints so Alice+Carol can actually find a route. diff --git a/itest/lnd_sweep_test.go b/itest/lnd_sweep_test.go index 377915412..db3e2171e 100644 --- a/itest/lnd_sweep_test.go +++ b/itest/lnd_sweep_test.go @@ -114,13 +114,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) } - // Bob should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Bob's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + flakeFundExtraUTXO(ht, bob) // Subscribe the invoice. streamCarol := carol.RPC.SubscribeSingleInvoice(payHash[:]) @@ -440,13 +434,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) } - // Bob should have enough wallet UTXOs here to sweep the HTLC in the - // end of this test. However, due to a known issue, Bob's wallet may - // report there's no UTXO available. For details, - // - https://github.com/lightningnetwork/lnd/issues/8786 - // - // TODO(yy): remove this step once the issue is resolved. - ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + flakeFundExtraUTXO(ht, bob) // Subscribe the invoice. streamCarol := carol.RPC.SubscribeSingleInvoice(payHash[:])