diff --git a/api/api_storage.go b/api/api_storage.go index 64d79a1e9..65ecf12ea 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -120,15 +120,16 @@ type SectorLog struct { } type SectorInfo struct { - SectorID abi.SectorNumber - State SectorState - CommD *cid.Cid - CommR *cid.Cid - Proof []byte - Deals []abi.DealID - Ticket SealTicket - Seed SealSeed - Retries uint64 + SectorID abi.SectorNumber + State SectorState + CommD *cid.Cid + CommR *cid.Cid + Proof []byte + Deals []abi.DealID + Ticket SealTicket + Seed SealSeed + Retries uint64 + ToUpgrade bool LastErr string diff --git a/cmd/lotus-storage-miner/sectors.go b/cmd/lotus-storage-miner/sectors.go index 59bb97c99..08d32d408 100644 --- a/cmd/lotus-storage-miner/sectors.go +++ b/cmd/lotus-storage-miner/sectors.go @@ -192,7 +192,7 @@ var sectorsListCmd = &cli.Command{ _, inSSet := commitedIDs[s] _, inASet := activeIDs[s] - fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\n", + fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n", s, st.State, yesno(inSSet), @@ -200,6 +200,7 @@ var sectorsListCmd = &cli.Command{ st.Ticket.Epoch, st.Seed.Epoch, st.Deals, + st.ToUpgrade, ) } diff --git a/extern/storage-sealing/upgrade_queue.go b/extern/storage-sealing/upgrade_queue.go index e508facd0..12a94f042 100644 --- a/extern/storage-sealing/upgrade_queue.go +++ b/extern/storage-sealing/upgrade_queue.go @@ -10,6 +10,13 @@ import ( "github.com/filecoin-project/specs-actors/actors/builtin/miner" ) +func (m *Sealing) IsMarkedForUpgrade(id abi.SectorNumber) bool { + m.upgradeLk.Lock() + _, found := m.toUpgrade[id] + m.upgradeLk.Unlock() + return found +} + func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error { m.upgradeLk.Lock() defer m.upgradeLk.Unlock() diff --git a/node/impl/storminer.go b/node/impl/storminer.go index daf011203..6c1b98db1 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -153,7 +153,8 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb Value: info.SeedValue, Epoch: info.SeedEpoch, }, - Retries: info.InvalidProofs, + Retries: info.InvalidProofs, + ToUpgrade: sm.Miner.IsMarkedForUpgrade(sid), LastErr: info.LastErr, Log: log, diff --git a/storage/sealing.go b/storage/sealing.go index 5360a1186..7d7140b98 100644 --- a/storage/sealing.go +++ b/storage/sealing.go @@ -47,3 +47,7 @@ func (m *Miner) RemoveSector(ctx context.Context, id abi.SectorNumber) error { func (m *Miner) MarkForUpgrade(id abi.SectorNumber) error { return m.sealing.MarkForUpgrade(id) } + +func (m *Miner) IsMarkedForUpgrade(id abi.SectorNumber) bool { + return m.sealing.IsMarkedForUpgrade(id) +}