Merge remote-tracking branch 'origin/master' into testnet/3

This commit is contained in:
Łukasz Magiera 2020-02-06 20:32:25 +01:00
commit 604c234484
3 changed files with 11 additions and 4 deletions

View File

@ -464,7 +464,8 @@ func powerLookup(ctx context.Context, vmctx types.VMContext, self *StoragePowerS
}
if !has {
return types.EmptyInt, aerrors.New(1, "miner not registered with storage power actor")
// A miner could be registered with storage power actor, but removed for some reasons, e.g. consensus fault
return types.EmptyInt, aerrors.New(1, "miner not registered with storage power actor, or removed already")
}
// TODO: Use local amt

View File

@ -120,12 +120,15 @@ var statePowerCmd = &cli.Command{
return err
}
res := power.TotalPower
tp := power.TotalPower
if cctx.Args().Present() {
res = power.MinerPower
mp := power.MinerPower
percI := types.BigDiv(types.BigMul(mp, types.NewInt(1000000)), tp)
fmt.Printf("%s(%s) / %s(%s) ~= %0.4f%%\n", mp.String(), mp.SizeStr(), tp.String(), tp.SizeStr(), float64(percI.Int64())/10000)
} else {
fmt.Printf("%s(%s)\n", tp.String(), tp.SizeStr())
}
fmt.Println(res.String())
return nil
},
}

View File

@ -36,6 +36,9 @@ func init() {
}
msgs, err := miner.SelectMessages(ctx, api.StateGetActor, head, pending)
if err != nil {
return err
}
if len(msgs) > build.BlockMessageLimit {
log.Error("SelectMessages returned too many messages: ", len(msgs))
msgs = msgs[:build.BlockMessageLimit]