itest+lntest: fix itest re the new sweeping behavior

This commit is contained in:
yyforyongyu committed 2024-04-20 04:41:29 +08:00
1 parent e0f0f5c6a9
commit d854c80aa7
6 files changed
+281 -142

No files matched your search

+19
View File
@@ -3,6 +3,7 @@ package itest
import (
"fmt"
"math"
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/wire"
@@ -312,6 +313,9 @@ func testSweepAnchorCPFPLocalForceClose(ht *lntest.HarnessTest) {
// the HTLC sweeping behaviors so we just perform a simple check and
// exit the test.
ht.AssertNumPendingSweeps(alice, 1)
// Finally, clean the mempool for the next test.
ht.CleanShutDown()
}
// testSweepHTLCs checks the sweeping behavior for HTLC outputs. Since HTLCs
@@ -403,6 +407,13 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
ht.FundCoins(btcutil.SatoshiPerBitcoin, bob)
ht.FundCoins(btcutil.SatoshiPerBitcoin, bob)
// For neutrino backend, we need two more UTXOs for Bob to create his
// sweeping txns.
if ht.IsNeutrinoBackend() {
ht.FundCoins(btcutil.SatoshiPerBitcoin, bob)
ht.FundCoins(btcutil.SatoshiPerBitcoin, bob)
}
// Subscribe the invoices.
stream1 := carol.RPC.SubscribeSingleInvoice(payHashSettled[:])
stream2 := carol.RPC.SubscribeSingleInvoice(payHashHold[:])
@@ -741,6 +752,14 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
return incoming, outgoing
}
//nolint:lll
// For neutrino backend, we need to give it more time to sync the
// blocks. There's a potential bug we need to fix:
// 2024-04-18 23:36:07.046 [ERR] NTFN: unable to get missed blocks: starting height 487 is greater than ending height 486
//
// TODO(yy): investigate and fix it.
time.Sleep(10 * time.Second)
// We should see Bob's sweeping txns in the mempool.
incomingSweep, outgoingSweep = identifySweepTxns()