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

lightningnetwork / lnd / 14000719599

21 Mar 2025 08:54PM UTC coverage: 58.717% (-10.3%) from 68.989%
14000719599

Pull #8754

github

web-flow
Merge 29f363f18 into 5235f3b24
Pull Request #8754: Add `Outbound` Remote Signer implementation

1562 of 2088 new or added lines in 41 files covered. (74.81%)

28126 existing lines in 464 files now uncovered.

97953 of 166822 relevant lines covered (58.72%)

1.82 hits per line

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

66.67
/lnrpc/watchtowerrpc/driver.go
1
//go:build watchtowerrpc
2
// +build watchtowerrpc
3

4
package watchtowerrpc
5

6
import (
7
        "fmt"
8

9
        "github.com/lightningnetwork/lnd/lnrpc"
10
)
11

12
// getConfig is a helper method that will fetch the config for sub-server given
13
// the main config dispatcher method. If we're unable to find the config
14
// that is meant for us in the config dispatcher, then we'll exit with an
15
// error. If enforceDependencies is set to true, the function also verifies that
16
// the dependencies in the config are properly set.
17
func getConfig(configRegistry lnrpc.SubServerConfigDispatcher,
18
        enforceDependencies bool) (*Config, error) {
3✔
19
        // We'll attempt to look up the config that we expect, according to our
3✔
20
        // subServerName name. If we can't find this, then we'll exit with an
3✔
21
        // error, as we're unable to properly initialize ourselves without this
3✔
22
        // config.
3✔
23
        subServerConf, ok := configRegistry.FetchConfig(subServerName)
3✔
24
        if !ok {
3✔
NEW
25
                return nil, fmt.Errorf("unable to find config for subserver "+
×
NEW
26
                        "type %s", subServerName)
×
UNCOV
27
        }
×
28

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

38
        if enforceDependencies {
6✔
39
                if err := verifyDependencies(config); err != nil {
3✔
NEW
40
                        return nil, err
×
NEW
41
                }
×
42
        }
43

44
        return config, nil
3✔
45
}
46

47
// verifyDependencies ensures that the dependencies in the config are properly
48
// set.
49
func verifyDependencies(_ *Config) error {
3✔
50
        return nil
3✔
51
}
3✔
52

53
func init() {
3✔
54
        subServer := &lnrpc.SubServerDriver{
3✔
55
                SubServerName: subServerName,
3✔
56
                NewGrpcHandler: func() lnrpc.GrpcHandler {
6✔
57
                        return &ServerShell{}
3✔
58
                },
3✔
59
        }
60

61
        // If the build tag is active, then we'll register ourselves as a
62
        // sub-RPC server within the global lnrpc package namespace.
63
        if err := lnrpc.RegisterSubServer(subServer); err != nil {
3✔
64
                panic(fmt.Sprintf("failed to register sub server driver "+
×
65
                        "'%s': %v", subServerName, err))
×
66
        }
67
}
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