extract outputs for mining node and markets node in separate functions

This commit is contained in:
Anton Evangelatov 2021-07-28 17:30:59 +03:00
parent 4cf5c8f656
commit 54c6a3a454

View File

@ -21,6 +21,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/api/v0api"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/api"
@ -103,6 +104,23 @@ func infoCmdAct(cctx *cli.Context) error {
fmt.Println()
if subsystems.Has(api.SectorStorageSubsystem) {
err := handleMiningInfo(cctx, ctx, fullapi, nodeApi)
if err != nil {
return err
}
}
if subsystems.Has(api.MarketsSubsystem) {
err := handleMarketsInfo(ctx, nodeApi)
if err != nil {
return err
}
}
return nil
}
func handleMiningInfo(cctx *cli.Context, ctx context.Context, fullapi v0api.FullNode, nodeApi api.StorageMiner) error {
maddr, err := getActorAddress(ctx, cctx)
if err != nil {
return err
@ -291,9 +309,11 @@ func infoCmdAct(cctx *cli.Context) error {
// TODO: grab actr state / info
// * Sealed sectors (count / bytes)
// * Power
}
if subsystems.Has(api.MarketsSubsystem) {
return nil
}
func handleMarketsInfo(ctx context.Context, nodeApi api.StorageMiner) error {
deals, err := nodeApi.MarketListIncompleteDeals(ctx)
if err != nil {
return err
@ -383,7 +403,6 @@ func infoCmdAct(cctx *cli.Context) error {
fmt.Printf("Retrieval Deals (complete): %d, %s\n", retrComplete.count, types.SizeStr(types.NewInt(retrComplete.bytes)))
fmt.Println()
}
return nil
}