From 5cb8c8df7ef2a000dde7d2776bd499d75abc9eae Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 28 Nov 2023 18:28:52 +0200 Subject: [PATCH] wtdb: rename CSessionInactive to CSessionTerminal Since we will now change this to mean that the session should not ever be activated again. --- watchtower/wtdb/client_db.go | 2 +- watchtower/wtdb/client_db_test.go | 6 +++--- watchtower/wtdb/client_session.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/watchtower/wtdb/client_db.go b/watchtower/wtdb/client_db.go index 5ed986ff6..6ebfd273b 100644 --- a/watchtower/wtdb/client_db.go +++ b/watchtower/wtdb/client_db.go @@ -578,7 +578,7 @@ func (c *ClientDB) RemoveTower(pubKey *btcec.PublicKey, addr net.Addr) error { return ErrTowerUnackedUpdates } err := markSessionStatus( - sessions, session, CSessionInactive, + sessions, session, CSessionTerminal, ) if err != nil { return err diff --git a/watchtower/wtdb/client_db_test.go b/watchtower/wtdb/client_db_test.go index 464a6a7d9..4619695d0 100644 --- a/watchtower/wtdb/client_db_test.go +++ b/watchtower/wtdb/client_db_test.go @@ -146,10 +146,10 @@ func (h *clientDBHarness) removeTower(pubKey *btcec.PublicKey, addr net.Addr, } for _, session := range h.listSessions(&tower.ID) { - require.Equal(h.t, wtdb.CSessionInactive, + require.Equal(h.t, wtdb.CSessionTerminal, session.Status, "expected status for session "+ "%v to be %v, got %v", session.ID, - wtdb.CSessionInactive, session.Status) + wtdb.CSessionTerminal, session.Status) } } } @@ -617,7 +617,7 @@ func testTowerStatusChange(h *clientDBHarness) { // to inactive. h.removeTower(tower.IdentityKey, nil, true, nil) assertTowerStatus(wtdb.TowerStatusInactive) - assertSessionStatus(wtdb.CSessionInactive) + assertSessionStatus(wtdb.CSessionTerminal) // Re-adding the tower in some way should re-active it and its session. h.createTower(towerAddr, nil) diff --git a/watchtower/wtdb/client_session.go b/watchtower/wtdb/client_session.go index e44331094..6b2890333 100644 --- a/watchtower/wtdb/client_session.go +++ b/watchtower/wtdb/client_session.go @@ -18,9 +18,9 @@ const ( // used for backups. CSessionActive CSessionStatus = 0 - // CSessionInactive indicates that the ClientSession is inactive and - // cannot be used for backups. - CSessionInactive CSessionStatus = 1 + // CSessionTerminal indicates that the ClientSession is in a terminal + // state and cannot be used for backups. + CSessionTerminal CSessionStatus = 1 ) // ClientSession encapsulates a SessionInfo returned from a successful