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

lightningnetwork / lnd / 17132206455

21 Aug 2025 03:56PM UTC coverage: 54.685% (-2.6%) from 57.321%
17132206455

Pull #10167

github

web-flow
Merge 5dd2ed093 into 0c2f045f5
Pull Request #10167: multi: bump Go to 1.24.6

4 of 31 new or added lines in 10 files covered. (12.9%)

23854 existing lines in 284 files now uncovered.

108937 of 199210 relevant lines covered (54.68%)

22026.48 hits per line

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

16.13
/lnrpc/routerrpc/driver.go
1
package routerrpc
2

3
import (
4
        "fmt"
5

6
        "github.com/lightningnetwork/lnd/lnrpc"
7
)
8

9
// createNewSubServer is a helper method that will create the new router sub
10
// server given the main config dispatcher method. If we're unable to find the
11
// config that is meant for us in the config dispatcher, then we'll exit with
12
// an error.
13
func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (
UNCOV
14
        *Server, lnrpc.MacaroonPerms, error) {
×
UNCOV
15

×
UNCOV
16
        // We'll attempt to look up the config that we expect, according to our
×
UNCOV
17
        // subServerName name. If we can't find this, then we'll exit with an
×
UNCOV
18
        // error, as we're unable to properly initialize ourselves without this
×
UNCOV
19
        // config.
×
UNCOV
20
        routeServerConf, ok := configRegistry.FetchConfig(subServerName)
×
UNCOV
21
        if !ok {
×
22
                return nil, nil, fmt.Errorf("unable to find config for "+
×
23
                        "subserver type %s", subServerName)
×
24
        }
×
25

26
        // Now that we've found an object mapping to our service name, we'll
27
        // ensure that it's the type we need.
UNCOV
28
        config, ok := routeServerConf.(*Config)
×
UNCOV
29
        if !ok {
×
30
                return nil, nil, fmt.Errorf("wrong type of config for "+
×
31
                        "subserver %s, expected %T got %T", subServerName,
×
32
                        &Config{}, routeServerConf)
×
33
        }
×
34

35
        // Before we try to make the new router service instance, we'll perform
36
        // some sanity checks on the arguments to ensure that they're usable.
UNCOV
37
        switch {
×
38
        case config.Router == nil:
×
39
                return nil, nil, fmt.Errorf("Router must be set to create " +
×
40
                        "Routerpc")
×
41
        }
42

UNCOV
43
        return New(config)
×
44
}
45

46
func init() {
4✔
47
        subServer := &lnrpc.SubServerDriver{
4✔
48
                SubServerName: subServerName,
4✔
49
                NewGrpcHandler: func() lnrpc.GrpcHandler {
4✔
UNCOV
50
                        return &ServerShell{}
×
UNCOV
51
                },
×
52
        }
53

54
        // If the build tag is active, then we'll register ourselves as a
55
        // sub-RPC server within the global lnrpc package namespace.
56
        if err := lnrpc.RegisterSubServer(subServer); err != nil {
4✔
57
                panic(fmt.Sprintf("failed to register sub server driver '%s': %v",
×
58
                        subServerName, err))
×
59
        }
60
}
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