• 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

73.68
/lnwallet/rpcwallet/remote_signer_builder.go
1
package rpcwallet
2

3
import (
4
        "errors"
5

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

9
// RemoteSignerBuilder is creates instances of the RemoteSigner interface, based
10
// on the provided configuration.
11
type RemoteSignerBuilder struct {
12
        cfg *lncfg.RemoteSigner
13
}
14

15
// NewRemoteSignerBuilder creates a new instance of the RemoteSignerBuilder.
16
func NewRemoteSignerBuilder(cfg *lncfg.RemoteSigner) *RemoteSignerBuilder {
4✔
17
        return &RemoteSignerBuilder{cfg}
4✔
18
}
4✔
19

20
// Build creates a new RemoteSigner instance. If the configuration specifies
21
// that an inbound remote signer should be used, a new InboundRemoteSigner is
22
// created. If the configuration specifies that an outbound remote signer should
23
// be used, a new OutboundRemoteSigner is created.
24
// The function returns the created RemoteSigner instance, and a cleanup
25
// function that should be called when the RemoteSigner is no longer needed.
26
func (b *RemoteSignerBuilder) Build() (RemoteSigner, func(), error) {
4✔
27
        if b.cfg == nil {
4✔
NEW
28
                return nil, nil, errors.New("remote signer config is nil")
×
NEW
29
        }
×
30

31
        // Validate that the configuration has valid values set.
32
        err := b.cfg.Validate()
4✔
33
        if err != nil {
4✔
NEW
34
                return nil, nil, err
×
NEW
35
        }
×
36

37
        if !b.cfg.Enable {
4✔
NEW
38
                // This should be unreachable, but this is an extra sanity check
×
NEW
39
                return nil, nil, errors.New("remote signer not enabled in " +
×
NEW
40
                        "config")
×
NEW
41
        }
×
42

43
        // Create the remote signer based on the configuration.
44
        switch b.cfg.SignerRole {
4✔
45
        case lncfg.DefaultInboundWatchOnlyRole:
4✔
46
                return b.createInboundRemoteSigner()
4✔
47

48
        case lncfg.OutboundWatchOnlyRole:
4✔
49
                return b.createOutboundRemoteSigner()
4✔
50

NEW
51
        default:
×
NEW
52
                return nil, nil, errors.New("unknown remote signer type")
×
53
        }
54
}
55

56
// createInboundRemoteSigner creates a new InboundRemoteSigner instance.
57
// The function returns the created InboundRemoteSigner instance, and a cleanup
58
// function that should be called when the InboundRemoteSigner is no longer
59
// needed.
60
func (b *RemoteSignerBuilder) createInboundRemoteSigner() (
61
        *InboundRemoteSigner, func(), error) {
4✔
62

4✔
63
        return NewInboundRemoteSigner(
4✔
64
                b.cfg.RPCHost, b.cfg.TLSCertPath, b.cfg.MacaroonPath,
4✔
65
                b.cfg.Timeout,
4✔
66
        )
4✔
67
}
4✔
68

69
// createOutboundRemoteSigner creates a new OutboundRemoteSigner instance.
70
// The function returns the created OutboundRemoteSigner instance, and a cleanup
71
// function that should be called when the OutboundRemoteSigner is no longer
72
// needed.
73
func (b *RemoteSignerBuilder) createOutboundRemoteSigner() (
74
        *OutboundRemoteSigner, func(), error) {
4✔
75

4✔
76
        outboundRemoteSigner, cleanUp := NewOutboundRemoteSigner(
4✔
77
                b.cfg.RequestTimeout, b.cfg.Timeout,
4✔
78
        )
4✔
79

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