From 53384e83d7c6d5488c0ec605959666dee49dc248 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 15 Sep 2020 11:16:35 -0700 Subject: [PATCH] migrate wallet access --- node/impl/full/wallet.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/node/impl/full/wallet.go b/node/impl/full/wallet.go index af786085b..bda8824e7 100644 --- a/node/impl/full/wallet.go +++ b/node/impl/full/wallet.go @@ -36,16 +36,13 @@ 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 - err := a.StateManager.WithParentStateTsk(types.EmptyTSK, a.StateManager.WithActor(addr, func(act *types.Actor) error { - bal = act.Balance - return nil - })) - + act, err := a.StateManager.LoadActorTsk(ctx, addr, types.EmptyTSK) if xerrors.Is(err, types.ErrActorNotFound) { return big.Zero(), nil + } else if err != nil { + return big.Zero(), err } - return bal, err + return act.Balance, nil } func (a *WalletAPI) WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error) {