• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13586005509

28 Feb 2025 10:14AM UTC coverage: 68.629% (+9.9%) from 58.77%
13586005509

Pull #9521

github

web-flow
Merge 37d3a70a5 into 8532955b3
Pull Request #9521: unit: remove GOACC, use Go 1.20 native coverage functionality

129950 of 189351 relevant lines covered (68.63%)

23726.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/watchtower/wtserver/delete_session.go
1
package wtserver
2

3
import (
4
        "github.com/lightningnetwork/lnd/watchtower/wtdb"
5
        "github.com/lightningnetwork/lnd/watchtower/wtwire"
6
)
7

8
// handleDeleteSession processes a DeleteSession request for a client with given
9
// SessionID. The id is assumed to have been previously authenticated by the
10
// brontide connection.
11
func (s *Server) handleDeleteSession(peer Peer, id *wtdb.SessionID) error {
9✔
12
        var failCode wtwire.DeleteSessionCode
9✔
13

9✔
14
        // Delete all session data associated with id.
9✔
15
        err := s.cfg.DB.DeleteSession(*id)
9✔
16
        switch {
9✔
17
        case err == nil:
8✔
18
                failCode = wtwire.CodeOK
8✔
19

8✔
20
                log.Debugf("Session %s deleted", id)
8✔
21

22
        case err == wtdb.ErrSessionNotFound:
1✔
23
                failCode = wtwire.DeleteSessionCodeNotFound
1✔
24

25
        default:
×
26
                failCode = wtwire.CodeTemporaryFailure
×
27
        }
28

29
        return s.replyDeleteSession(peer, id, failCode)
9✔
30
}
31

32
// replyDeleteSession sends a DeleteSessionReply back to the peer containing the
33
// error code resulting from processes a DeleteSession request.
34
func (s *Server) replyDeleteSession(peer Peer, id *wtdb.SessionID,
35
        code wtwire.DeleteSessionCode) error {
9✔
36

9✔
37
        msg := &wtwire.DeleteSessionReply{
9✔
38
                Code: code,
9✔
39
        }
9✔
40

9✔
41
        err := s.sendMessage(peer, msg)
9✔
42
        if err != nil {
9✔
43
                log.Errorf("Unable to send DeleteSessionReply to %s", id)
×
44
        }
×
45

46
        // Return the write error if the request succeeded.
47
        if code == wtwire.CodeOK {
17✔
48
                return err
8✔
49
        }
8✔
50

51
        // Otherwise the request failed, return a connection failure to
52
        // disconnect the client.
53
        return &connFailure{
1✔
54
                ID:   *id,
1✔
55
                Code: code,
1✔
56
        }
1✔
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc