Skip to content

Commit

Permalink
multiwallet: Don't fail if key is found in any wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jun 25, 2021
1 parent 3f33363 commit c10d99e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chain/wallet/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"go.uber.org/fx"
"go.uber.org/multierr"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
Expand Down Expand Up @@ -56,18 +57,18 @@ func nonNil(wallets ...getif) []api.Wallet {
func (m MultiWallet) find(ctx context.Context, address address.Address, wallets ...getif) (api.Wallet, error) {
ws := nonNil(wallets...)

var merr error

for _, w := range ws {
have, err := w.WalletHas(ctx, address)
if err != nil {
return nil, err
}
merr = multierr.Append(merr, err)

if have {
if err == nil && have {
return w, nil
}
}

return nil, nil
return nil, merr
}

func (m MultiWallet) WalletNew(ctx context.Context, keyType types.KeyType) (address.Address, error) {
Expand Down

0 comments on commit c10d99e

Please sign in to comment.