Skip to content

Commit

Permalink
dcrlncli: Rename from lncli and lnd -> dcrlnd. -- To be squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Jan 14, 2019
1 parent d659fca commit 1f010de
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 47 deletions.
File renamed without changes.
File renamed without changes.
46 changes: 23 additions & 23 deletions cmd/lncli/commands.go → cmd/dcrlncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ func actionDecorator(f func(*cli.Context) error) func(*cli.Context) error {
return fmt.Errorf("Wallet is already unlocked")
}

// lnd might be active, but not possible to contact
// dcrlnd might be active, but not possible to contact
// using RPC if the wallet is encrypted. If we get
// error code Unimplemented, it means that lnd is
// error code Unimplemented, it means that dcrlnd is
// running, but the RPC server is not active yet (only
// WalletUnlocker server active) and most likely this
// is because of an encrypted wallet.
if ok && s.Code() == codes.Unimplemented {
return fmt.Errorf("Wallet is encrypted. " +
"Please unlock using 'lncli unlock', " +
"or set password using 'lncli create'" +
"Please unlock using 'dcrlncli unlock', " +
"or set password using 'dcrlncli create'" +
" if this is the first time starting " +
"lnd.")
"dcrlnd.")
}
return err
}
Expand Down Expand Up @@ -400,7 +400,7 @@ func sendMany(ctx *cli.Context) error {
var connectCommand = cli.Command{
Name: "connect",
Category: "Peers",
Usage: "Connect to a remote lnd peer.",
Usage: "Connect to a remote dcrlnd peer.",
ArgsUsage: "<pubkey>@host",
Flags: []cli.Flag{
cli.BoolFlag{
Expand Down Expand Up @@ -446,7 +446,7 @@ func connectPeer(ctx *cli.Context) error {
var disconnectCommand = cli.Command{
Name: "disconnect",
Category: "Peers",
Usage: "Disconnect a remote lnd peer identified by public key.",
Usage: "Disconnect a remote dcrlnd peer identified by public key.",
ArgsUsage: "<pubkey>",
Flags: []cli.Flag{
cli.StringFlag{
Expand Down Expand Up @@ -1109,9 +1109,9 @@ var abandonChannelCommand = cli.Command{
Description: `
Removes all channel state from the database except for a close
summary. This method can be used to get rid of permanently unusable
channels due to bugs fixed in newer versions of lnd.
channels due to bugs fixed in newer versions of dcrlnd.
Only available when lnd is built in debug mode.
Only available when dcrlnd is built in debug mode.
To view which funding_txids/output_indexes can be used for this command,
see the channel_point values within the listchannels command output.
Expand Down Expand Up @@ -1223,15 +1223,15 @@ func listPeers(ctx *cli.Context) error {
var createCommand = cli.Command{
Name: "create",
Category: "Startup",
Usage: "Initialize a wallet when starting lnd for the first time.",
Usage: "Initialize a wallet when starting dcrlnd for the first time.",
Description: `
The create command is used to initialize an lnd wallet from scratch for
The create command is used to initialize an dcrlnd wallet from scratch for
the very first time. This is interactive command with one required
argument (the password), and one optional argument (the mnemonic
passphrase).
The first argument (the password) is required and MUST be greater than
8 characters. This will be used to encrypt the wallet within lnd. This
8 characters. This will be used to encrypt the wallet within dcrlnd. This
MUST be remembered as it will be required to fully start up the daemon.
The second argument is an optional 24-word mnemonic derived from BIP
Expand Down Expand Up @@ -1489,7 +1489,7 @@ mnemonicCheck:
return err
}

fmt.Println("\nlnd successfully initialized!")
fmt.Println("\ndcrlnd successfully initialized!")

return nil
}
Expand All @@ -1499,8 +1499,8 @@ var unlockCommand = cli.Command{
Category: "Startup",
Usage: "Unlock an encrypted wallet at startup.",
Description: `
The unlock command is used to decrypt lnd's wallet state in order to
start up. This command MUST be run after booting up lnd before it's
The unlock command is used to decrypt dcrlnd's wallet state in order to
start up. This command MUST be run after booting up dcrlnd before it's
able to carry out its duties. An exception is if a user is running with
--noseedbackup, then a default passphrase will be used.
`,
Expand Down Expand Up @@ -1555,7 +1555,7 @@ func unlock(ctx *cli.Context) error {
return err
}

fmt.Println("\nlnd successfully unlocked!")
fmt.Println("\ndcrlnd successfully unlocked!")

return nil
}
Expand All @@ -1565,11 +1565,11 @@ var changePasswordCommand = cli.Command{
Category: "Startup",
Usage: "Change an encrypted wallet's password at startup.",
Description: `
The changepassword command is used to Change lnd's encrypted wallet's
The changepassword command is used to Change dcrlnd's encrypted wallet's
password. It will automatically unlock the daemon if the password change
is successful.
If one did not specify a password for their wallet (running lnd with
If one did not specify a password for their wallet (running dcrlnd with
--noseedbackup), one must restart their daemon without
--noseedbackup and use this command. The "current password" field
should be left empty.
Expand Down Expand Up @@ -2218,17 +2218,17 @@ var sendToRouteCommand = cli.Command{
There are three ways to specify routes:
* using the --routes parameter to manually specify a JSON encoded
set of routes in the format of the return value of queryroutes:
(lncli sendtoroute --payment_hash=<pay_hash> --routes=<route>)
dcrlncli sendtoroute --payment_hash=<pay_hash> --routes=<route>
* passing the routes as a positional argument:
(lncli sendtoroute --payment_hash=pay_hash <route>)
dcrlncli sendtoroute --payment_hash=pay_hash <route>
* or reading in the routes from stdin, which can allow chaining the
response from queryroutes, or even read in a file with a set of
pre-computed routes:
(lncli queryroutes --args.. | lncli sendtoroute --payment_hash= -
dcrlncli queryroutes --args.. | drlncli sendtoroute --payment_hash= -
notice the '-' at the end, which signals that lncli should read
notice the '-' at the end, which signals that dcrlncli should read
the route in from stdin
`,
Flags: []cli.Flag{
Expand Down Expand Up @@ -2552,7 +2552,7 @@ var listInvoicesCommand = cli.Command{
explicitly set the flag to false. If none of the parameters are
specified, then the last 100 invoices will be returned.
For example: if you have 200 invoices, "lncli listinvoices" will return
For example: if you have 200 invoices, "dcrlncli listinvoices" will return
the last 100 created. If you wish to retrieve the previous 100, the
first_offset_index of the response can be used as the index_offset of
the next listinvoices request.`,
Expand Down
35 changes: 15 additions & 20 deletions cmd/lncli/main.go → cmd/dcrlncli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
)

func fatal(err error) {
fmt.Fprintf(os.Stderr, "[lncli] %v\n", err)
fmt.Fprintf(os.Stderr, "[dcrlncli] %v\n", err)
os.Exit(1)
}

Expand Down Expand Up @@ -167,11 +167,11 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
return "", "", fmt.Errorf("unknown network: %v", network)
}

// We'll now fetch the lnddir so we can make a decision on how to
// We'll now fetch the dcrlnddir so we can make a decision on how to
// properly read the macaroons (if needed) and also the cert. This will
// either be the default, or will have been overwritten by the end
// user.
lndDir := cleanAndExpandPath(ctx.GlobalString("lnddir"))
lndDir := cleanAndExpandPath(ctx.GlobalString("dcrlnddir"))

// If the macaroon path as been manually provided, then we'll only
// target the specified file.
Expand All @@ -180,7 +180,7 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
macPath = cleanAndExpandPath(ctx.GlobalString("macaroonpath"))
} else {
// Otherwise, we'll go into the path:
// lnddir/data/chain/<chain>/<network> in order to fetch the
// dcrlnddir/data/chain/<chain>/<network> in order to fetch the
// macaroon that we need.
macPath = filepath.Join(
lndDir, defaultDataDir, defaultChainSubDir, chain,
Expand All @@ -190,11 +190,11 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {

tlsCertPath := cleanAndExpandPath(ctx.GlobalString("tlscertpath"))

// If a custom lnd directory was set, we'll also check if custom paths
// for the TLS cert and macaroon file were set as well. If not, we'll
// override their paths so they can be found within the custom lnd
// directory set. This allows us to set a custom lnd directory, along
// with custom paths to the TLS cert and macaroon file.
// If a custom dcrlnd directory was set, we'll also check if custom
// paths for the TLS cert and macaroon file were set as well. If not,
// we'll override their paths so they can be found within the custom
// dcrlnd directory set. This allows us to set a custom lnd directory,
// along with custom paths to the TLS cert and macaroon file.
if lndDir != defaultLndDir {
tlsCertPath = filepath.Join(lndDir, defaultTLSCertFilename)
}
Expand All @@ -204,33 +204,28 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {

func main() {
app := cli.NewApp()
app.Name = "lncli"
app.Name = "dcrlncli"
app.Version = build.Version()
app.Usage = "control plane for your Lightning Network Daemon (lnd)"
app.Usage = "control plane for your Decred Lightning Network Daemon (dcrlnd)"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "rpcserver",
Value: defaultRPCHostPort,
Usage: "host:port of ln daemon",
Usage: "host:port of Decred LN daemon",
},
cli.StringFlag{
Name: "lnddir",
Name: "dcrlnddir",
Value: defaultLndDir,
Usage: "path to lnd's base directory",
Usage: "path to dcrlnd's base directory",
},
cli.StringFlag{
Name: "tlscertpath",
Value: defaultTLSCertPath,
Usage: "path to TLS certificate",
},
cli.StringFlag{
Name: "chain, c",
Usage: "the chain lnd is running on e.g. bitcoin",
Value: "bitcoin",
},
cli.StringFlag{
Name: "network, n",
Usage: "the network lnd is running on e.g. mainnet, " +
Usage: "the network drlnd is running on e.g. mainnet, " +
"testnet, etc.",
Value: "mainnet",
},
Expand Down
8 changes: 4 additions & 4 deletions lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func lndMain() error {
return err
}

// Create macaroon files for lncli to use if they don't exist.
// Create macaroon files for dcrlncli to use if they don't exist.
if !fileExists(cfg.AdminMacPath) && !fileExists(cfg.ReadMacPath) &&
!fileExists(cfg.InvoiceMacPath) {

Expand Down Expand Up @@ -748,9 +748,9 @@ func waitForWalletPassword(grpcEndpoints, restEndpoints []net.Addr,
wg.Wait()

// Wait for user to provide the password.
ltndLog.Infof("Waiting for wallet encryption password. Use `lncli " +
"create` to create a wallet, `lncli unlock` to unlock an " +
"existing wallet, or `lncli changepassword` to change the " +
ltndLog.Infof("Waiting for wallet encryption password. Use `dcrlncli " +
"create` to create a wallet, `dcrlncli unlock` to unlock an " +
"existing wallet, or `dcrlncli changepassword` to change the " +
"password of an existing wallet and unlock it.")

// We currently don't distinguish between getting a password to be used
Expand Down

0 comments on commit 1f010de

Please sign in to comment.