@@ -665,6 +665,26 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
665665 // needed to clean up the mempool.
666666 ht .MineBlocksAndAssertNumTxes (1 , 2 )
667667
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+
668688 // The above mined block should confirm Bob's force close tx, and his
669689 // contractcourt will offer the HTLC to his sweeper. We are not testing
670690 // the HTLC sweeping behaviors so we just perform a simple check and
0 commit comments