diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index ecfc51648..5fac172f4 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -217,7 +217,10 @@ func (sm *StateManager) GetActor(addr address.Address, ts *types.TipSet) (*types func (sm *StateManager) GetBalance(addr address.Address, ts *types.TipSet) (types.BigInt, error) { act, err := sm.GetActor(addr, ts) if err != nil { - return types.BigInt{}, xerrors.Errorf("get actor: %w", err) + if xerrors.Is(err, types.ErrActorNotFound) { + return types.NewInt(0), nil + } + return types.EmptyInt, xerrors.Errorf("get actor: %w", err) } return act.Balance, nil diff --git a/chain/types/fil.go b/chain/types/fil.go index aed01f2b2..c882c1852 100644 --- a/chain/types/fil.go +++ b/chain/types/fil.go @@ -12,7 +12,7 @@ type FIL BigInt func (f FIL) String() string { r := new(big.Rat).SetFrac(f.Int, big.NewInt(build.FilecoinPrecision)) - return strings.TrimRight(r.FloatString(18), "0") + return strings.TrimRight(r.FloatString(18), "0.") } func ParseFIL(s string) (FIL, error) {