Don't pannic on walletDefAddr with no addrs
This commit is contained in:
@@ -2,6 +2,7 @@ package impl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/chain"
|
||||
@@ -132,6 +133,9 @@ func (a *FullNodeAPI) WalletDefaultAddress(ctx context.Context) (address.Address
|
||||
if err != nil {
|
||||
return address.Undef, err
|
||||
}
|
||||
if len(addrs) == 0 {
|
||||
return address.Undef, xerrors.New("no addresses in wallet")
|
||||
}
|
||||
|
||||
// TODO: store a default address in the config or 'wallet' portion of the repo
|
||||
return addrs[0], nil
|
||||
|
||||
Reference in New Issue
Block a user