Skip to content

Commit

Permalink
silent fail on api.StatePledgeCollateral
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed Jul 3, 2020
1 parent fe49bcd commit 3db9665
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/stats/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,16 @@ func (ht *apiIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error)
}

func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
pc, err := api.StatePledgeCollateral(ctx, tipset.Key())
if err != nil {
return err
}

attoFil := types.NewInt(build.FilecoinPrecision).Int
var p models.Point

pcFil := new(big.Rat).SetFrac(pc.Int, attoFil)
pcFilFloat, _ := pcFil.Float64()
p := NewPoint("chain.pledge_collateral", pcFilFloat)
pl.AddPoint(p)
pc, err := api.StatePledgeCollateral(ctx, tipset.Key())
if err == nil {
pcFil := new(big.Rat).SetFrac(pc.Int, attoFil)
pcFilFloat, _ := pcFil.Float64()
p = NewPoint("chain.pledge_collateral", pcFilFloat)
pl.AddPoint(p)
}

netBal, err := api.WalletBalance(ctx, builtin.RewardActorAddr)
if err != nil {
Expand Down

0 comments on commit 3db9665

Please sign in to comment.