Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
daced29
lnd+lncfg: Refactor `RemoteSigner` Config
ViktorT-11 Dec 9, 2024
fab2d28
multi: correct `DefaultRemoteSignerRPCTimeout` docs
ViktorT-11 May 20, 2024
439d088
lnd: add new `remotesigner` macaroon entity
ViktorT-11 Aug 23, 2024
22d2bf0
walletrpc: add `SignCoordinatorStreams` RPC
ViktorT-11 May 14, 2024
46d5ec8
rpcwallet: add `RemoteSignerConnection` interface
ViktorT-11 May 14, 2024
c888dac
rpcwallet: add `OutboundConnection` implementation
ViktorT-11 May 14, 2024
ed308da
rpcwallet: add `RemoteSignerConnectionBuilder`
ViktorT-11 May 14, 2024
c7c7131
rpcwallet: use `RemoteSignerConnection` in RPCKeyRing
ViktorT-11 May 14, 2024
a2a7092
lnd: refactor `createLivenessMonitor` signature
ViktorT-11 Dec 17, 2024
12a8642
multi: use `RemoteSignerConnection` for health check
ViktorT-11 May 14, 2024
569995a
multi: Add `watchonlynode` Namespace to `Config`
ViktorT-11 Dec 6, 2024
606e786
fn: add CancelOrQuit helper
ViktorT-11 Dec 5, 2024
aabc838
rpcwallet: add `RemoteSignerClient` struct
ViktorT-11 May 14, 2024
65a095c
f - rpcwallet: use GoroutineManager in remote signer signer client
ViktorT-11 Oct 31, 2024
2e4e67a
rpcwallet: Add `RemoteSignerClientBuilder`
ViktorT-11 Sep 1, 2024
6a06421
lnd: add `RemoteSignerClient` instance on startup
ViktorT-11 May 14, 2024
f32d4c2
lncfg: allow `watchonlynode.enable`
ViktorT-11 Dec 6, 2024
470fedc
conf: add `remotesigner.allowinboundconnection`
ViktorT-11 Dec 6, 2024
909a42b
rpcwallet: add `SignCoordinator` struct
ViktorT-11 May 14, 2024
b8d7ca9
rpcwallet: add `InboundConnection` implementation
ViktorT-11 Dec 6, 2024
4d67f2c
lnrpc: add `AllowRemoteSigner` `WalletState` proto
ViktorT-11 May 14, 2024
7f38431
rpcperms: allow some RPCs before `rpcActive` state
ViktorT-11 May 14, 2024
70b1646
rpcperms: fix `SetServerActive` function docs typo
ViktorT-11 May 14, 2024
910ba3e
multi: enable `RpcServer` before dependencies exist
ViktorT-11 May 14, 2024
ba6efe3
multi: add `RemoteSignerConnection` to walletrpc conf
ViktorT-11 May 14, 2024
097e4c1
walletrpc: implement `SignCoordinatorStreams` RPC
ViktorT-11 May 14, 2024
e0ea73c
multi: populate `RemoteSignerConnection` ref early
ViktorT-11 May 28, 2024
edbf38f
f - multi: populate `RemoteSignerConnection` ref early
ViktorT-11 Dec 5, 2024
16bb101
multi: add `ReadySignal` to `WalletController`
ViktorT-11 May 14, 2024
aefe0d6
lnd: await remote signer connection on startup
ViktorT-11 May 28, 2024
995e520
multi: allow `remotesigner.allowinboundconnection`
ViktorT-11 Dec 6, 2024
000476e
docs: add outbound signer to remote signing docs
ViktorT-11 May 13, 2024
a4069b9
docs: update release notes
ViktorT-11 Oct 31, 2024
5251ff6
lntest: separate creation/start of watch-only node
ViktorT-11 May 14, 2024
d073365
itest: fix testRemoteSignerRandomSeedOutbound typo
ViktorT-11 Mar 21, 2025
42c0628
itest: add outbound remote signer itests
ViktorT-11 May 14, 2024
fefc46c
itest: add testOutboundRSMacaroonEnforcement itest
ViktorT-11 Aug 28, 2024
dcd0209
itest: wrap deriveCustomScopeAccounts at 80 chars
ViktorT-11 May 17, 2024
50de404
rpcwallet: allow remote signer to reconnect
ViktorT-11 Mar 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,15 @@ type Config struct {

RPCMiddleware *lncfg.RPCMiddleware `group:"rpcmiddleware" namespace:"rpcmiddleware"`

// RemoteSigner defines how to connect to a remote signer node. If this
// is enabled, the node acts as a watch-only node in a remote signer
// setup.
RemoteSigner *lncfg.RemoteSigner `group:"remotesigner" namespace:"remotesigner"`

// WatchOnlyNode defines how to connect to a watch-only node. If this is
// enabled, the node acts as a remote signer in a remote signer setup.
WatchOnlyNode *lncfg.WatchOnlyNode `group:"watchonlynode" namespace:"watchonlynode"`

Sweeper *lncfg.Sweeper `group:"sweeper" namespace:"sweeper"`

Htlcswitch *lncfg.Htlcswitch `group:"htlcswitch" namespace:"htlcswitch"`
Expand Down Expand Up @@ -757,10 +764,9 @@ func DefaultConfig() Config {
ChannelCommitBatchSize: defaultChannelCommitBatchSize,
CoinSelectionStrategy: defaultCoinSelectionStrategy,
KeepFailedPaymentAttempts: defaultKeepFailedPaymentAttempts,
RemoteSigner: &lncfg.RemoteSigner{
Timeout: lncfg.DefaultRemoteSignerRPCTimeout,
},
Sweeper: lncfg.DefaultSweeperConfig(),
RemoteSigner: lncfg.DefaultRemoteSignerCfg(),
WatchOnlyNode: lncfg.DefaultWatchOnlyNodeCfg(),
Sweeper: lncfg.DefaultSweeperConfig(),
Htlcswitch: &lncfg.Htlcswitch{
MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout,
QuiescenceTimeout: lncfg.DefaultQuiescenceTimeout,
Expand Down Expand Up @@ -1790,6 +1796,13 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
)
}

// Validate that the node isn't configured as both a remote signer and a
// watch-only node.
if cfg.RemoteSigner.Enable && cfg.WatchOnlyNode.Enable {
return nil, fmt.Errorf("cannot enable both the remotesigner " +
"and watchonly mode simultaneously")
}

// Validate the subconfigs for workers, caches, and the tower client.
err = lncfg.Validate(
cfg.Workers,
Expand All @@ -1800,6 +1813,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
cfg.HealthChecks,
cfg.RPCMiddleware,
cfg.RemoteSigner,
cfg.WatchOnlyNode,
cfg.Sweeper,
cfg.Htlcswitch,
cfg.Invoices,
Expand Down
42 changes: 37 additions & 5 deletions config_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,28 +867,57 @@ func (d *RPCSignerWalletImpl) BuildChainControl(
partialChainControl *chainreg.PartialChainControl,
walletConfig *btcwallet.Config) (*chainreg.ChainControl, func(), error) {

// Keeps track of both the remote signer and the chain control clean up
// functions.
var (
cleanUpTasks []func()
cleanUp = func() {
for _, fn := range cleanUpTasks {
fn()
}
}
)

walletController, err := btcwallet.New(
*walletConfig, partialChainControl.Cfg.BlockCache,
)
if err != nil {
err := fmt.Errorf("unable to create wallet controller: %w", err)
d.logger.Error(err)
return nil, nil, err
return nil, cleanUp, err
}

remoteSignerConnBuilder := rpcwallet.NewRemoteSignerConnectionBuilder(
d.DefaultWalletImpl.cfg.RemoteSigner,
)

// Create the remote signer connection instance.
remoteSignerConn, err := remoteSignerConnBuilder.Build(
context.Background(),
)
if err != nil {
err := fmt.Errorf("unable to set up remote signer: %w", err)
d.logger.Error(err)

return nil, cleanUp, err
}

cleanUpTasks = append(cleanUpTasks, remoteSignerConn.Stop)

baseKeyRing := keychain.NewBtcWalletKeyRing(
walletController.InternalWallet(), walletConfig.CoinType,
)

rpcKeyRing, err := rpcwallet.NewRPCKeyRing(
baseKeyRing, walletController,
d.DefaultWalletImpl.cfg.RemoteSigner, walletConfig.NetParams,
remoteSignerConn, walletConfig.NetParams,
)
if err != nil {
err := fmt.Errorf("unable to create RPC remote signing wallet "+
"%v", err)
d.logger.Error(err)
return nil, nil, err

return nil, cleanUp, err
}

// Create, and start the lnwallet, which handles the core payment
Expand All @@ -907,15 +936,18 @@ func (d *RPCSignerWalletImpl) BuildChainControl(

// We've created the wallet configuration now, so we can finish
// initializing the main chain control.
activeChainControl, cleanUp, err := chainreg.NewChainControl(
activeChainControl, ccCleanUp, err := chainreg.NewChainControl(
lnWalletConfig, rpcKeyRing, partialChainControl,
)
if err != nil {
err := fmt.Errorf("unable to create chain control: %w", err)
d.logger.Error(err)
return nil, nil, err

return nil, cleanUp, err
}

cleanUpTasks = append(cleanUpTasks, ccCleanUp)

return activeChainControl, cleanUp, nil
}

Expand Down
9 changes: 9 additions & 0 deletions docs/release-notes/release-notes-0.21.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@

## RPC Additions

* [SignCoordinatorStreams](https://github.com/lightningnetwork/lnd/pull/8754)
allows a remote signer to connect to the lnd node, if the
`remotesigner.allowinboundconnection` cfg value has been set to `true`.

## lncli Additions

# Improvements
Expand All @@ -48,6 +52,11 @@
This applies to both funders and fundees, with the ability to override the
value during channel opening or acceptance.

* [Added](https://github.com/lightningnetwork/lnd/pull/8754) support for a new
remote signer type `outbound`, which makes an outbound connection to the
watch-only node, instead of requiring on an inbound connection from the
watch-only node.

## RPC Updates

## lncli Updates
Expand Down
Loading
Loading