itest: remove direct reference to stanby nodes

Prepares the upcoming refactor. We now never call `ht.Alice` directly,
instead, we always init `alice := ht.Alice` so it's easier to see how
they are removed in a following commit.
This commit is contained in:
yyforyongyu committed 2024-12-20 19:38:05 +08:00
1 parent ef167835dd
commit 3eda87fff9
16 files changed
+157 -108

No files matched your search

+13 -9
View File
@@ -39,6 +39,8 @@ var watchtowerTestCases = []*lntest.TestCase{
// testTowerClientTowerAndSessionManagement tests the various control commands
// that a user has over the client's set of active towers and sessions.
func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
alice := ht.Alice
const (
chanAmt = funding.MaxBtcFundingAmount
externalIP = "1.2.3.4"
@@ -104,13 +106,13 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
ht.FundCoins(btcutil.SatoshiPerBitcoin, dave)
// Connect Dave and Alice.
ht.ConnectNodes(dave, ht.Alice)
ht.ConnectNodes(dave, alice)
// Open a channel between Dave and Alice.
params := lntest.OpenChannelParams{
Amt: chanAmt,
}
chanPoint := ht.OpenChannel(dave, ht.Alice, params)
chanPoint := ht.OpenChannel(dave, alice, params)
// Show that the Wallis tower is currently seen as an active session
// candidate.
@@ -122,7 +124,7 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
// Make some back-ups and assert that they are added to a session with
// the tower.
generateBackups(ht, dave, ht.Alice, 4)
generateBackups(ht, dave, alice, 4)
// Assert that one of the sessions now has 4 backups.
assertNumBackups(ht, dave.RPC, wallisPk, 4, false)
@@ -139,7 +141,7 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
require.False(ht, info.SessionInfo[0].ActiveSessionCandidate)
// Back up a few more states.
generateBackups(ht, dave, ht.Alice, 4)
generateBackups(ht, dave, alice, 4)
// These should _not_ be on the tower. Therefore, the number of
// back-ups on the tower should be the same as before.
@@ -163,7 +165,7 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
})
// Generate some more back-ups.
generateBackups(ht, dave, ht.Alice, 4)
generateBackups(ht, dave, alice, 4)
// Assert that they get added to the first tower (Wallis) and that the
// number of sessions with Wallis has not changed - in other words, the
@@ -205,7 +207,7 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
assertNumSessions(wallisPk, 4, false)
// Any new back-ups should now be backed up on a different session.
generateBackups(ht, dave, ht.Alice, 2)
generateBackups(ht, dave, alice, 2)
assertNumBackups(ht, dave.RPC, wallisPk, 10, false)
findSession(wallisPk, 2)
@@ -238,6 +240,8 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
// testTowerClientSessionDeletion tests that sessions are correctly deleted
// when they are deemed closable.
func testTowerClientSessionDeletion(ht *lntest.HarnessTest) {
alice := ht.Alice
const (
chanAmt = funding.MaxBtcFundingAmount
numInvoices = 5
@@ -290,18 +294,18 @@ func testTowerClientSessionDeletion(ht *lntest.HarnessTest) {
ht.FundCoins(btcutil.SatoshiPerBitcoin, dave)
// Connect Dave and Alice.
ht.ConnectNodes(dave, ht.Alice)
ht.ConnectNodes(dave, alice)
// Open a channel between Dave and Alice.
params := lntest.OpenChannelParams{
Amt: chanAmt,
}
chanPoint := ht.OpenChannel(dave, ht.Alice, params)
chanPoint := ht.OpenChannel(dave, alice, params)
// Since there are 2 updates made for every payment and the maximum
// number of updates per session has been set to 10, make 5 payments
// between the pair so that the session is exhausted.
generateBackups(ht, dave, ht.Alice, maxUpdates)
generateBackups(ht, dave, alice, maxUpdates)
// Assert that one of the sessions now has 10 backups.
assertNumBackups(ht, dave.RPC, wallisPk, 10, false)