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

lightningnetwork / lnd / 16181619122

09 Jul 2025 10:33PM UTC coverage: 55.326% (-2.3%) from 57.611%
16181619122

Pull #10060

github

web-flow
Merge d15e8671f into 0e830da9d
Pull Request #10060: sweep: fix expected spending events being missed

9 of 26 new or added lines in 2 files covered. (34.62%)

23695 existing lines in 280 files now uncovered.

108518 of 196143 relevant lines covered (55.33%)

22354.81 hits per line

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

14.29
/lnrpc/devrpc/driver.go
1
//go:build dev
2
// +build dev
3

4
package devrpc
5

6
import (
7
        "fmt"
8

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

12
// createNewSubServer is a helper method that will create the new sub server
13
// given 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.
16
func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (
UNCOV
17
        *Server, lnrpc.MacaroonPerms, error) {
×
UNCOV
18

×
UNCOV
19
        // We'll attempt to look up the config that we expect, according to our
×
UNCOV
20
        // subServerName name. If we can't find this, then we'll exit with an
×
UNCOV
21
        // error, as we're unable to properly initialize ourselves without this
×
UNCOV
22
        // config.
×
UNCOV
23
        subServerConf, ok := configRegistry.FetchConfig(subServerName)
×
UNCOV
24
        if !ok {
×
25
                return nil, nil, fmt.Errorf("unable to find config for "+
×
26
                        "subserver type %s", subServerName)
×
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.
UNCOV
31
        config, ok := subServerConf.(*Config)
×
UNCOV
32
        if !ok {
×
33
                return nil, nil, fmt.Errorf("wrong type of config for "+
×
34
                        "subserver %s, expected %T got %T", subServerName,
×
35
                        &Config{}, subServerConf)
×
36
        }
×
37

38
        // Before we try to make the new service instance, we'll perform
39
        // some sanity checks on the arguments to ensure that they're useable.
UNCOV
40
        if config.ActiveNetParams == nil {
×
41
                return nil, nil, fmt.Errorf("ActiveNetParams must be set to " +
×
42
                        "create DevRPC")
×
43
        }
×
44

UNCOV
45
        if config.GraphDB == nil {
×
46
                return nil, nil, fmt.Errorf("GraphDB must be set to create " +
×
47
                        "DevRPC")
×
48
        }
×
49

UNCOV
50
        return New(config)
×
51
}
52

53
func init() {
3✔
54
        subServer := &lnrpc.SubServerDriver{
3✔
55
                SubServerName: subServerName,
3✔
56
                NewGrpcHandler: func() lnrpc.GrpcHandler {
3✔
UNCOV
57
                        return &ServerShell{}
×
UNCOV
58
                },
×
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