ProvingSet -> ActiveSectors
This commit is contained in:
parent
bbc2657023
commit
56d13534b4
@ -243,8 +243,8 @@ type FullNode interface {
|
|||||||
// If the filterOut boolean is set to true, any sectors in the filter are excluded.
|
// If the filterOut boolean is set to true, any sectors in the filter are excluded.
|
||||||
// If false, only those sectors in the filter are included.
|
// If false, only those sectors in the filter are included.
|
||||||
StateMinerSectors(context.Context, address.Address, *abi.BitField, bool, types.TipSetKey) ([]*ChainSectorInfo, error)
|
StateMinerSectors(context.Context, address.Address, *abi.BitField, bool, types.TipSetKey) ([]*ChainSectorInfo, error)
|
||||||
// StateMinerProvingSet returns info about those sectors that a given miner is actively proving.
|
// StateMinerActiveSectors returns info about sectors that a given miner is actively proving.
|
||||||
StateMinerProvingSet(context.Context, address.Address, types.TipSetKey) ([]*ChainSectorInfo, error)
|
StateMinerActiveSectors(context.Context, address.Address, types.TipSetKey) ([]*ChainSectorInfo, error)
|
||||||
// StateMinerProvingDeadline calculates the deadline at some epoch for a proving period
|
// StateMinerProvingDeadline calculates the deadline at some epoch for a proving period
|
||||||
// and returns the deadline-related calculations.
|
// and returns the deadline-related calculations.
|
||||||
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*miner.DeadlineInfo, error)
|
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*miner.DeadlineInfo, error)
|
||||||
|
@ -581,7 +581,7 @@ func (c *FullNodeStruct) StateMinerSectors(ctx context.Context, addr address.Add
|
|||||||
return c.Internal.StateMinerSectors(ctx, addr, filter, filterOut, tsk)
|
return c.Internal.StateMinerSectors(ctx, addr, filter, filterOut, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerProvingSet(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
func (c *FullNodeStruct) StateMinerActiveSectors(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
return c.Internal.StateMinerProvingSet(ctx, addr, tsk)
|
return c.Internal.StateMinerProvingSet(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
cli/state.go
10
cli/state.go
@ -49,7 +49,7 @@ var stateCmd = &cli.Command{
|
|||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
statePowerCmd,
|
statePowerCmd,
|
||||||
stateSectorsCmd,
|
stateSectorsCmd,
|
||||||
stateProvingSetCmd,
|
stateActiveSectorsCmd,
|
||||||
statePledgeCollateralCmd,
|
statePledgeCollateralCmd,
|
||||||
stateListActorsCmd,
|
stateListActorsCmd,
|
||||||
stateListMinersCmd,
|
stateListMinersCmd,
|
||||||
@ -241,9 +241,9 @@ var stateSectorsCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var stateProvingSetCmd = &cli.Command{
|
var stateActiveSectorsCmd = &cli.Command{
|
||||||
Name: "proving",
|
Name: "active-sectors",
|
||||||
Usage: "Query the proving set of a miner",
|
Usage: "Query the active sector set of a miner",
|
||||||
ArgsUsage: "[minerAddress]",
|
ArgsUsage: "[minerAddress]",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api, closer, err := GetFullNodeAPI(cctx)
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
@ -268,7 +268,7 @@ var stateProvingSetCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sectors, err := api.StateMinerProvingSet(ctx, maddr, ts.Key())
|
sectors, err := api.StateMinerActiveSectors(ctx, maddr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -138,20 +138,20 @@ var sectorsListCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pset, err := fullApi.StateMinerProvingSet(ctx, maddr, types.EmptyTSK)
|
activeSet, err := fullApi.StateMinerActiveSectors(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
provingIDs := make(map[abi.SectorNumber]struct{}, len(pset))
|
activeIDs := make(map[abi.SectorNumber]struct{}, len(activeSet))
|
||||||
for _, info := range pset {
|
for _, info := range activeSet {
|
||||||
provingIDs[info.ID] = struct{}{}
|
activeIDs[info.ID] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
sset, err := fullApi.StateMinerSectors(ctx, maddr, nil, true, types.EmptyTSK)
|
sset, err := fullApi.StateMinerSectors(ctx, maddr, nil, true, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
commitedIDs := make(map[abi.SectorNumber]struct{}, len(pset))
|
commitedIDs := make(map[abi.SectorNumber]struct{}, len(activeSet))
|
||||||
for _, info := range sset {
|
for _, info := range sset {
|
||||||
commitedIDs[info.ID] = struct{}{}
|
commitedIDs[info.ID] = struct{}{}
|
||||||
}
|
}
|
||||||
@ -170,13 +170,13 @@ var sectorsListCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, inSSet := commitedIDs[s]
|
_, inSSet := commitedIDs[s]
|
||||||
_, inPSet := provingIDs[s]
|
_, inASet := activeIDs[s]
|
||||||
|
|
||||||
fmt.Fprintf(w, "%d: %s\tsSet: %s\tpSet: %s\ttktH: %d\tseedH: %d\tdeals: %v\n",
|
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\n",
|
||||||
s,
|
s,
|
||||||
st.State,
|
st.State,
|
||||||
yesno(inSSet),
|
yesno(inSSet),
|
||||||
yesno(inPSet),
|
yesno(inASet),
|
||||||
st.Ticket.Epoch,
|
st.Ticket.Epoch,
|
||||||
st.Seed.Epoch,
|
st.Seed.Epoch,
|
||||||
st.Deals,
|
st.Deals,
|
||||||
|
@ -70,7 +70,7 @@ func (a *StateAPI) StateMinerSectors(ctx context.Context, addr address.Address,
|
|||||||
return stmgr.GetMinerSectorSet(ctx, a.StateManager, ts, addr, filter, filterOut)
|
return stmgr.GetMinerSectorSet(ctx, a.StateManager, ts, addr, filter, filterOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerProvingSet(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
func (a *StateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
var out []*api.ChainSectorInfo
|
var out []*api.ChainSectorInfo
|
||||||
|
|
||||||
err := a.StateManager.WithParentStateTsk(tsk,
|
err := a.StateManager.WithParentStateTsk(tsk,
|
||||||
|
Loading…
Reference in New Issue
Block a user