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

lightningnetwork / lnd / 13974489001

20 Mar 2025 04:32PM UTC coverage: 56.292% (-2.9%) from 59.168%
13974489001

Pull #8754

github

web-flow
Merge aed149e6b into ea050d06f
Pull Request #8754: Add `Outbound` Remote Signer implementation

594 of 1713 new or added lines in 26 files covered. (34.68%)

23052 existing lines in 272 files now uncovered.

105921 of 188165 relevant lines covered (56.29%)

23796.34 hits per line

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

0.0
/lnwallet/rpcwallet/remote_signer_connection_builder.go
1
package rpcwallet
2

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

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

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

16
// NewRemoteSignerConnectionBuilder creates a new instance of the
17
// RemoteSignerBuilder.
18
func NewRemoteSignerConnectionBuilder(
NEW
19
        cfg *lncfg.RemoteSigner) *RemoteSignerConnectionBuilder {
×
NEW
20

×
NEW
21
        return &RemoteSignerConnectionBuilder{cfg}
×
NEW
22
}
×
23

24
// Build creates a new RemoteSignerConnection instance. If the configuration
25
// specifies that an inbound remote signer should be used, a new
26
// OutboundConnection is created. If the configuration specifies that an
27
// outbound remote signer should be used, a new InboundConnection is created.
28
// The function returns the created RemoteSignerConnection instance, and a
29
// cleanup function that should be called when the RemoteSignerConnection is no
30
// longer needed.
31
func (b *RemoteSignerConnectionBuilder) Build(
NEW
32
        ctx context.Context) (RemoteSignerConnection, error) {
×
NEW
33

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

40
        // Create the remote signer based on the configuration.
NEW
41
        if !b.cfg.AllowInboundConnection {
×
NEW
42
                return NewOutboundConnection(ctx, b.cfg.ConnectionCfg)
×
NEW
43
        }
×
44

NEW
45
        inboundConnection := NewInboundConnection(
×
NEW
46
                b.cfg.RequestTimeout, b.cfg.Timeout,
×
NEW
47
        )
×
NEW
48

×
NEW
49
        return inboundConnection, nil
×
50
}
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