• 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

85.11
/lnwallet/rpcwallet/remote_signer_client_builder.go
1
package rpcwallet
2

3
import (
4
        "github.com/lightningnetwork/lnd/lncfg"
5
        "github.com/lightningnetwork/lnd/lnrpc"
6
        "github.com/lightningnetwork/lnd/lnrpc/signrpc"
7
        "github.com/lightningnetwork/lnd/lnrpc/walletrpc"
8
)
9

10
type rscBuilder = RemoteSignerClientBuilder
11

12
// RemoteSignerClientBuilder is creates instances of the RemoteSignerClient
13
// interface, based on the provided configuration.
14
type RemoteSignerClientBuilder struct {
15
        cfg *lncfg.RemoteSigner
16
}
17

18
// NewRemoteSignerClientBuilder creates a new instance of the
19
// RemoteSignerClientBuilder.
20
func NewRemoteSignerClientBuilder(cfg *lncfg.RemoteSigner) *rscBuilder {
4✔
21
        return &rscBuilder{cfg}
4✔
22
}
4✔
23

24
// Build creates a new RemoteSignerClient instance. If the configuration enables
25
// an outbound remote signer, a new OutboundRemoteSignerClient will be returned.
26
// Else, a NoOpClient will be returned.
27
func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
28
        RemoteSignerClient, error) {
4✔
29

4✔
30
        var (
4✔
31
                walletServer walletrpc.WalletKitServer
4✔
32
                signerServer signrpc.SignerServer
4✔
33
        )
4✔
34

4✔
35
        for _, subServer := range subServers {
8✔
36
                if server, ok := subServer.(walletrpc.WalletKitServer); ok {
8✔
37
                        walletServer = server
4✔
38
                }
4✔
39

40
                if server, ok := subServer.(signrpc.SignerServer); ok {
8✔
41
                        signerServer = server
4✔
42
                }
4✔
43
        }
44

45
        // Check if we have all servers and if the configuration enables an
46
        // outbound remote signer. If not, return a NoOpClient.
47
        if walletServer == nil || signerServer == nil {
4✔
NEW
48
                log.Debugf("Using a No Op remote signer client due to " +
×
NEW
49
                        "current sub-server support")
×
NEW
50

×
NEW
51
                return &NoOpClient{}, nil
×
NEW
52
        }
×
53

54
        if b.cfg == nil || b.cfg.SignerRole != lncfg.OutboundSignerRole ||
4✔
55
                b.cfg.RPCHost == "" || b.cfg.MacaroonPath == "" ||
4✔
56
                b.cfg.TLSCertPath == "" || b.cfg.RequestTimeout <= 0 ||
4✔
57
                b.cfg.Timeout <= 0 {
8✔
58

4✔
59
                log.Debugf("Using a No Op remote signer client due to " +
4✔
60
                        "current remote signer config")
4✔
61

4✔
62
                return &NoOpClient{}, nil
4✔
63
        }
4✔
64

65
        // An outbound remote signer client is enabled, therefore we create one.
66
        log.Debugf("Using an outbound remote signer client")
4✔
67

4✔
68
        streamFeeder := NewStreamFeeder(
4✔
69
                b.cfg.RPCHost, b.cfg.MacaroonPath, b.cfg.TLSCertPath,
4✔
70
                b.cfg.Timeout,
4✔
71
        )
4✔
72

4✔
73
        rsClient, err := NewOutboundClient(
4✔
74
                walletServer, signerServer, streamFeeder, b.cfg.RequestTimeout,
4✔
75
        )
4✔
76
        if err != nil {
4✔
NEW
77
                return nil, err
×
NEW
78
        }
×
79

80
        return rsClient, nil
4✔
81
}
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