Merge pull request #412 from halseth/walletpassword-not-empty

walletunlocker: check that password is non-empty
This commit is contained in:
Olaoluwa Osuntokun 2017-12-02 18:56:46 -08:00 committed by GitHub
commit 9be054c3a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,6 +45,14 @@ func New(authSvc *bakery.Service, chainDir string,
func (u *UnlockerService) CreateWallet(ctx context.Context,
in *lnrpc.CreateWalletRequest) (*lnrpc.CreateWalletResponse, error) {
// Require the provided password to have a length of at
// least 8 characters.
password := in.Password
if len(password) < 8 {
return nil, fmt.Errorf("password must have " +
"at least 8 characters")
}
netDir := btcwallet.NetworkDir(u.chainDir, u.netParams)
loader := wallet.NewLoader(u.netParams, netDir)
@ -61,7 +69,7 @@ func (u *UnlockerService) CreateWallet(ctx context.Context,
// We send the password over the CreatePasswords channel, such that it
// can be used by lnd to open or create the wallet.
u.CreatePasswords <- in.Password
u.CreatePasswords <- password
return &lnrpc.CreateWalletResponse{}, nil
}