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

lightningnetwork / lnd / 11954082915

21 Nov 2024 01:20PM UTC coverage: 59.327% (+0.6%) from 58.776%
11954082915

Pull #8754

github

ViktorTigerstrom
itest: wrap deriveCustomScopeAccounts at 80 chars

This commit fixes that word wrapping for the deriveCustomScopeAccounts
function docs, and ensures that it wraps at 80 characters or less.
Pull Request #8754: Add `Outbound` Remote Signer implementation

1940 of 2984 new or added lines in 44 files covered. (65.01%)

226 existing lines in 37 files now uncovered.

135234 of 227947 relevant lines covered (59.33%)

19316.75 hits per line

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

65.79
/lnrpc/wtclientrpc/driver.go
1
package wtclientrpc
2

3
import (
4
        "errors"
5
        "fmt"
6

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

10
// getConfig is a helper method that will fetch the config for sub-server given
11
// the main config dispatcher method. If we're unable to find the config
12
// that is meant for us in the config dispatcher, then we'll exit with an
13
// error. If enforceDependencies is set to true, the function also verifies that
14
// the dependencies in the config are properly set.
15
func getConfig(configRegistry lnrpc.SubServerConfigDispatcher,
16
        enforceDependencies bool) (*Config, error) {
4✔
17

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

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

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

43
        return config, nil
4✔
44
}
45

46
// verifyDependencies ensures that the dependencies in the config are properly
47
// set.
48
func verifyDependencies(config *Config) error {
4✔
49
        // Before we try to make the new service instance, we'll perform
4✔
50
        // some sanity checks on the arguments to ensure that they're usable.
4✔
51
        switch {
4✔
52
        case config.Resolver == nil:
×
NEW
53
                return errors.New("a lncfg.TCPResolver is required")
×
54
        }
55

56
        return nil
4✔
57
}
58

59
func init() {
4✔
60
        subServer := &lnrpc.SubServerDriver{
4✔
61
                SubServerName: subServerName,
4✔
62
                NewGrpcHandler: func() lnrpc.GrpcHandler {
8✔
63
                        return &ServerShell{}
4✔
64
                },
4✔
65
        }
66

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