Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: wallet: Print addr when key not found #9873

Merged
merged 1 commit into from
Dec 14, 2022
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
10 changes: 5 additions & 5 deletions chain/wallet/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,22 @@ func (m MultiWallet) WalletSign(ctx context.Context, signer address.Address, toS
return nil, err
}
if w == nil {
return nil, xerrors.Errorf("key not found")
return nil, xerrors.Errorf("key not found for %s", signer)
}

return w.WalletSign(ctx, signer, toSign, meta)
}

func (m MultiWallet) WalletExport(ctx context.Context, address address.Address) (*types.KeyInfo, error) {
w, err := m.find(ctx, address, m.Remote, m.Local)
func (m MultiWallet) WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error) {
w, err := m.find(ctx, addr, m.Remote, m.Local)
if err != nil {
return nil, err
}
if w == nil {
return nil, xerrors.Errorf("key not found")
return nil, xerrors.Errorf("key not found for %s", addr)
}

return w.WalletExport(ctx, address)
return w.WalletExport(ctx, addr)
}

func (m MultiWallet) WalletImport(ctx context.Context, info *types.KeyInfo) (address.Address, error) {
Expand Down
2 changes: 1 addition & 1 deletion chain/wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (w *LocalWallet) WalletExport(ctx context.Context, addr address.Address) (*
return nil, xerrors.Errorf("failed to find key to export: %w", err)
}
if k == nil {
return nil, xerrors.Errorf("key not found")
return nil, xerrors.Errorf("key not found for %s", addr)
}

return &k.KeyInfo, nil
Expand Down