extract outputs for mining node and markets node in separate functions
This commit is contained in:
parent
0dd83c6755
commit
cea26348c4
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
@ -103,6 +104,23 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
if subsystems.Has(api.SectorStorageSubsystem) {
|
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)
|
maddr, err := getActorAddress(ctx, cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -291,9 +309,11 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
// TODO: grab actr state / info
|
// TODO: grab actr state / info
|
||||||
// * Sealed sectors (count / bytes)
|
// * Sealed sectors (count / bytes)
|
||||||
// * Power
|
// * Power
|
||||||
}
|
|
||||||
|
|
||||||
if subsystems.Has(api.MarketsSubsystem) {
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleMarketsInfo(ctx context.Context, nodeApi api.StorageMiner) error {
|
||||||
deals, err := nodeApi.MarketListIncompleteDeals(ctx)
|
deals, err := nodeApi.MarketListIncompleteDeals(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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.Printf("Retrieval Deals (complete): %d, %s\n", retrComplete.count, types.SizeStr(types.NewInt(retrComplete.bytes)))
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user