itest+lntest: fix itest re the new block driven behavior

This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:26 +08:00
1 parent 558d9bd3ce
commit 521b1fc34a
10 files changed
+445 -108

No files matched your search

+9 -3
View File
@@ -1579,14 +1579,20 @@ func (h *HarnessTest) CleanupForceClose(hn *node.HarnessNode) {
h.AssertNumPendingForceClose(hn, 1)
// Mine enough blocks for the node to sweep its funds from the force
// closed channel. The commit sweep resolver is able to broadcast the
// sweep tx up to one block before the CSV elapses, so wait until
// defaulCSV-1.
// closed channel. The commit sweep resolver is able to offer the input
// to the sweeper at defaulCSV-1, and broadcast the sweep tx once one
// more block is mined.
//
// NOTE: we might empty blocks here as we don't know the exact number
// of blocks to mine. This may end up mining more blocks than needed.
h.MineEmptyBlocks(node.DefaultCSV - 1)
// Assert there is one pending sweep.
h.AssertNumPendingSweeps(hn, 1)
// Mine a block to trigger the sweep.
h.MineEmptyBlocks(1)
// The node should now sweep the funds, clean up by mining the sweeping
// tx.
h.MineBlocksAndAssertNumTxes(1, 1)
+17
View File
@@ -2591,3 +2591,20 @@ func (h *HarnessTest) AssertWalletLockedBalance(hn *node.HarnessNode,
require.NoError(h, err, "%s: timeout checking locked balance",
hn.Name())
}
// AssertNumPendingSweeps asserts the number of pending sweeps for the given
// node.
func (h *HarnessTest) AssertNumPendingSweeps(hn *node.HarnessNode, n int) {
err := wait.NoError(func() error {
resp := hn.RPC.PendingSweeps()
num := len(resp.PendingSweeps)
if num == n {
return nil
}
return fmt.Errorf("want %d , got %d", n, num)
}, DefaultTimeout)
require.NoErrorf(h, err, "%s: check pending sweeps timeout", hn.Name())
}
+1 -5
View File
@@ -199,7 +199,7 @@ func (cfg *BaseNodeConfig) GenArgs() []string {
nodeArgs := []string{
"--nobootstrap",
"--debuglevel=debug,DISC=trace",
"--debuglevel=debug",
"--bitcoin.defaultchanconfs=1",
"--accept-keysend",
"--keep-failed-payment-attempts",
@@ -217,10 +217,6 @@ func (cfg *BaseNodeConfig) GenArgs() []string {
fmt.Sprintf("--trickledelay=%v", trickleDelay),
fmt.Sprintf("--profile=%d", cfg.ProfilePort),
// Use a small batch window so we can broadcast our sweep
// transactions faster.
"--sweeper.batchwindowduration=5s",
// Use a small batch delay so we can broadcast the
// announcements quickly in the tests.
"--gossip.sub-batch-delay=5ms",