mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
watchtower: add FetchSessionCommittedUpdates func to DB
In this commit, a new tower client db function is added that can be used to fetch all the committed updates for a given session ID. This is done in preparation for an upcoming commit where the CommittedUpdates will be removed from the ClientSession struct.
This commit is contained in:
@@ -242,6 +242,22 @@ func (m *ClientDB) listClientSessions(tower *wtdb.TowerID,
|
||||
return sessions, nil
|
||||
}
|
||||
|
||||
// FetchSessionCommittedUpdates retrieves the current set of un-acked updates
|
||||
// of the given session.
|
||||
func (m *ClientDB) FetchSessionCommittedUpdates(id *wtdb.SessionID) (
|
||||
[]wtdb.CommittedUpdate, error) {
|
||||
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
sess, ok := m.activeSessions[*id]
|
||||
if !ok {
|
||||
return nil, wtdb.ErrClientSessionNotFound
|
||||
}
|
||||
|
||||
return sess.CommittedUpdates, nil
|
||||
}
|
||||
|
||||
// CreateClientSession records a newly negotiated client session in the set of
|
||||
// active sessions. The session can be identified by its SessionID.
|
||||
func (m *ClientDB) CreateClientSession(session *wtdb.ClientSession) error {
|
||||
|
Reference in New Issue
Block a user