mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
lnd+walletunlocker: implement ChangePassword RPC
This commit is contained in:
22
lnd.go
22
lnd.go
@@ -879,16 +879,25 @@ func waitForWalletPassword(grpcEndpoints, restEndpoints []string,
|
||||
serverOpts []grpc.ServerOption, proxyOpts []grpc.DialOption,
|
||||
tlsConf *tls.Config) (*WalletUnlockParams, error) {
|
||||
|
||||
// Set up a new PasswordService, which will listen
|
||||
// for passwords provided over RPC.
|
||||
// Set up a new PasswordService, which will listen for passwords
|
||||
// provided over RPC.
|
||||
grpcServer := grpc.NewServer(serverOpts...)
|
||||
|
||||
chainConfig := cfg.Bitcoin
|
||||
if registeredChains.PrimaryChain() == litecoinChain {
|
||||
chainConfig = cfg.Litecoin
|
||||
}
|
||||
|
||||
// The macaroon files are passed to the wallet unlocker since they are
|
||||
// also encrypted with the wallet's password. These files will be
|
||||
// deleted within it and recreated when successfully changing the
|
||||
// wallet's password.
|
||||
macaroonFiles := []string{
|
||||
filepath.Join(macaroonDatabaseDir, macaroons.DBFilename),
|
||||
cfg.AdminMacPath, cfg.ReadMacPath, cfg.InvoiceMacPath,
|
||||
}
|
||||
pwService := walletunlocker.New(
|
||||
chainConfig.ChainDir, activeNetParams.Params,
|
||||
chainConfig.ChainDir, activeNetParams.Params, macaroonFiles,
|
||||
)
|
||||
lnrpc.RegisterWalletUnlockerServer(grpcServer, pwService)
|
||||
|
||||
@@ -951,9 +960,10 @@ func waitForWalletPassword(grpcEndpoints, restEndpoints []string,
|
||||
wg.Wait()
|
||||
|
||||
// Wait for user to provide the password.
|
||||
ltndLog.Infof("Waiting for wallet encryption password. " +
|
||||
"Use `lncli create` to create wallet, or " +
|
||||
"`lncli unlock` to unlock already created wallet.")
|
||||
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 " +
|
||||
"password of an existing wallet and unlock it.")
|
||||
|
||||
// We currently don't distinguish between getting a password to be used
|
||||
// for creation or unlocking, as a new wallet db will be created if
|
||||
|
Reference in New Issue
Block a user