diff --git a/node/impl/full/wallet.go b/node/impl/full/wallet.go index d2dd4ee12..68550a4f3 100644 --- a/node/impl/full/wallet.go +++ b/node/impl/full/wallet.go @@ -2,6 +2,8 @@ package full import ( "context" + "github.com/filecoin-project/specs-actors/actors/abi/big" + init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" "github.com/filecoin-project/lotus/lib/sigs" @@ -37,10 +39,16 @@ func (a *WalletAPI) WalletList(ctx context.Context) ([]address.Address, error) { func (a *WalletAPI) WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error) { var bal types.BigInt - return bal, a.StateManager.WithParentStateTsk(types.EmptyTSK, a.StateManager.WithActor(addr, func(act *types.Actor) error { + err := a.StateManager.WithParentStateTsk(types.EmptyTSK, a.StateManager.WithActor(addr, func(act *types.Actor) error { bal = act.Balance return nil })) + + if xerrors.Is(err, init_.ErrAddressNotFound) { + return big.Zero(), nil + } else { + return bal, err + } } func (a *WalletAPI) WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error) {