From c270d7a2f700d32a93d1c0f7f5c3ebf2faa2a619 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Sat, 1 Aug 2020 16:04:38 +0100 Subject: [PATCH] Fix bad path spec for validator deposits --- cmd/root.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 2e24c7d..9826640 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -319,15 +319,18 @@ func walletAndAccountsFromPath(ctx context.Context, path string) (e2wtypes.Walle return nil, nil, errors.Wrap(err, "faild to open wallet for account") } - accounts := make([]e2wtypes.Account, 0) - - if path == "" { - path = "^.*$" - } else { - path = fmt.Sprintf("^%s$", path) + _, accountSpec, err := e2wallet.WalletAndAccountNames(path) + if err != nil { + return nil, nil, errors.Wrap(err, "failed to obtain account specification") } - re := regexp.MustCompile(path) + if accountSpec == "" { + accountSpec = "^.*$" + } else { + accountSpec = fmt.Sprintf("^%s$", accountSpec) + } + re := regexp.MustCompile(accountSpec) + accounts := make([]e2wtypes.Account, 0) for account := range wallet.Accounts(ctx) { if re.Match([]byte(account.Name())) { accounts = append(accounts, account)