@@ -665,6 +665,26 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
665
665
// needed to clean up the mempool.
666
666
ht .MineBlocksAndAssertNumTxes (1 , 2 )
667
667
668
+ // We mined a block above, which confirmed Bob's force closing tx and
669
+ // his anchor sweeping tx. Bob should now have a new change output
670
+ // created from that sweeping tx, which can be used as the input to
671
+ // sweep his HTLC.
672
+ // Also in the above mined block, the HTLC will be offered to Bob's
673
+ // sweeper for sweeping, which requires a wallet utxo since it's a
674
+ // zero fee HTLC.
675
+ // There's the possible race that,
676
+ // - btcwallet is processing this block, and marking the change output
677
+ // as confirmed.
678
+ // - btcwallet notifies LND about the new block.
679
+ // If the block notification comes first, LND's sweeper will not be
680
+ // able to sweep this HTLC as it thinks the wallet UTXO is still
681
+ // unconfirmed.
682
+ // TODO(yy): To fix the above issue, we need to make sure btcwallet
683
+ // should update its internal state first before notifying the new
684
+ // block, which is scheduled to be fixed during the btcwallet SQLizing
685
+ // saga.
686
+ ht .MineEmptyBlocks (1 )
687
+
668
688
// The above mined block should confirm Bob's force close tx, and his
669
689
// contractcourt will offer the HTLC to his sweeper. We are not testing
670
690
// the HTLC sweeping behaviors so we just perform a simple check and
@@ -766,14 +786,6 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
766
786
// - when sweeping HTLCs, he needs one utxo for each sweep.
767
787
numUTXOs := 2
768
788
769
- // Bob should have enough wallet UTXOs here to sweep the HTLC in the
770
- // end of this test. However, due to a known issue, Bob's wallet may
771
- // report there's no UTXO available. For details,
772
- // - https://github.com/lightningnetwork/lnd/issues/8786
773
- //
774
- // TODO(yy): remove this extra UTXO once the issue is resolved.
775
- numUTXOs ++
776
-
777
789
// For neutrino backend, we need two more UTXOs for Bob to create his
778
790
// sweeping txns.
779
791
if ht .IsNeutrinoBackend () {
@@ -1802,14 +1814,6 @@ func testFeeReplacement(ht *lntest.HarnessTest) {
1802
1814
// - when sweeping HTLCs, he needs one utxo for each sweep.
1803
1815
numUTXOs := 2
1804
1816
1805
- // Bob should have enough wallet UTXOs here to sweep the HTLC in the
1806
- // end of this test. However, due to a known issue, Bob's wallet may
1807
- // report there's no UTXO available. For details,
1808
- // - https://github.com/lightningnetwork/lnd/issues/8786
1809
- //
1810
- // TODO(yy): remove this extra UTXO once the issue is resolved.
1811
- numUTXOs ++
1812
-
1813
1817
// For neutrino backend, we need two more UTXOs for Bob to create his
1814
1818
// sweeping txns.
1815
1819
if ht .IsNeutrinoBackend () {
0 commit comments