Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The docker image contains:
Docker is very flexible so you can use that information however you choose. This guide isn't meant to be prescriptive.


### Example: Running loopd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a weird non-breaking space that probably got in there through copy/paste. My IDE showed it so I removed it.

### Example: Running loopd

One way of running `loopd` is
```
Expand Down
46 changes: 43 additions & 3 deletions loopd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"fmt"
"os"
"path"
"path/filepath"
"time"

Expand Down Expand Up @@ -46,6 +47,10 @@ var (

defaultSelfSignedOrganization = "loop autogenerated cert"

// defaultLndMacaroon is the default macaroon file we use if the old,
// deprecated --lnd.macaroondir config option is used.
defaultLndMacaroon = "admin.macaroon"

// DefaultTLSCertPath is the default full path of the autogenerated TLS
// certificate.
DefaultTLSCertPath = filepath.Join(
Expand All @@ -70,9 +75,20 @@ var (
)

type lndConfig struct {
Host string `long:"host" description:"lnd instance rpc address"`
MacaroonDir string `long:"macaroondir" description:"Path to the directory containing all the required lnd macaroons"`
TLSPath string `long:"tlspath" description:"Path to lnd tls certificate"`
Host string `long:"host" description:"lnd instance rpc address"`

// MacaroonDir is the directory that contains all the macaroon files
// required for the remote connection.
MacaroonDir string `long:"macaroondir" description:"DEPRECATED: Use macaroonpath."`

// MacaroonPath is the path to the single macaroon that should be used
// instead of needing to specify the macaroon directory that contains
// all of lnd's macaroons. The specified macaroon MUST have all
// permissions that all the subservers use, otherwise permission errors
// will occur.
MacaroonPath string `long:"macaroonpath" description:"The full path to the single macaroon to use, either the admin.macaroon or a custom baked one. Cannot be specified at the same time as macaroondir. A custom macaroon must contain ALL permissions required for all subservers to work, otherwise permission errors will occur."`

TLSPath string `long:"tlspath" description:"Path to lnd tls certificate"`
}

type loopServerConfig struct {
Expand Down Expand Up @@ -235,6 +251,30 @@ func Validate(cfg *Config) error {
return err
}

// Make sure only one of the macaroon options is used.
switch {
case cfg.Lnd.MacaroonPath != "" && cfg.Lnd.MacaroonDir != "":
return fmt.Errorf("use --lnd.macaroonpath only")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Shouldn't this be either macaroondir or macaroonpath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But since the macaroondir is deprecated, this error is a bit clearer what the action should be. And it's the exact same commit that I added to Pool, so at least the error messages will be the same :)


case cfg.Lnd.MacaroonDir != "":
// With the new version of lndclient we can only specify a
// single macaroon instead of all of them. If the old
// macaroondir is used, we use the admin macaroon located in
// that directory.
cfg.Lnd.MacaroonPath = path.Join(
lncfg.CleanAndExpandPath(cfg.Lnd.MacaroonDir),
defaultLndMacaroon,
)

case cfg.Lnd.MacaroonPath != "":
cfg.Lnd.MacaroonPath = lncfg.CleanAndExpandPath(
cfg.Lnd.MacaroonPath,
)

default:
return fmt.Errorf("must specify --lnd.macaroonpath")
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion loopd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func newListenerCfg(config *Config, rpcCfg RPCConfig) *listenerCfg {
svcCfg := &lndclient.LndServicesConfig{
LndAddress: cfg.Host,
Network: network,
MacaroonDir: cfg.MacaroonDir,
CustomMacaroonPath: cfg.MacaroonPath,
TLSPath: cfg.TLSPath,
CheckVersion: LoopMinRequiredLndVersion,
BlockUntilChainSynced: true,
Expand Down
8 changes: 7 additions & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ This file tracks release notes for the loop client.

#### New Features
* If lnd is locked when the loop client starts up, it will wait for lnd to be
unlocked. Previous versions would exit with an error.
unlocked. Previous versions would exit with an error.
* Loop will no longer need all `lnd` subserver macaroons to be present in the
`--lnd.macaroondir`. Instead the new `--lnd.macaroonpath` option can be
pointed to a single macaroon, for example the `admin.macaroon` or a custom
baked one with the exact permissions needed for Loop. If the now deprecated
flag/option `--lnd.macaroondir` is used, it will fall back to use only the
`admin.macaroon` from that directory.

#### Breaking Changes
* The `AutoOut`, `AutoOutBudgetSat` and `AutoOutBudgetStartSec` fields in the
Expand Down