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

lightningnetwork / lnd / 12115442155

02 Dec 2024 08:28AM UTC coverage: 48.662% (-10.3%) from 58.948%
12115442155

Pull #9175

github

ellemouton
netann: update ChanAnn2 validation to work for P2WSH channels

This commit expands the ChannelAnnouncement2 validation for the case
where it is announcing a P2WSH channel.
Pull Request #9175: lnwire+netann: update structure of g175 messages to be pure TLV

6 of 314 new or added lines in 9 files covered. (1.91%)

27532 existing lines in 434 files now uncovered.

97890 of 201164 relevant lines covered (48.66%)

0.52 hits per line

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

68.75
/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 {
1✔
12
        var failCode wtwire.DeleteSessionCode
1✔
13

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

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

UNCOV
22
        case err == wtdb.ErrSessionNotFound:
×
UNCOV
23
                failCode = wtwire.DeleteSessionCodeNotFound
×
24

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

29
        return s.replyDeleteSession(peer, id, failCode)
1✔
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 {
1✔
36

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

1✔
41
        err := s.sendMessage(peer, msg)
1✔
42
        if err != nil {
1✔
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 {
2✔
48
                return err
1✔
49
        }
1✔
50

51
        // Otherwise the request failed, return a connection failure to
52
        // disconnect the client.
UNCOV
53
        return &connFailure{
×
UNCOV
54
                ID:   *id,
×
UNCOV
55
                Code: code,
×
UNCOV
56
        }
×
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