Skip to content

Commit

Permalink
fix: lmcli: make 'sectors list' DDO-aware (#11839)
Browse files Browse the repository at this point in the history
* fix: lmcli: make 'sectors list' DDO-aware

* lmcli: Add ddo info to sectors status
  • Loading branch information
magik6k authored Apr 5, 2024
1 parent c827cf1 commit 83421e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cli/spcli/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sort"
"strconv"
"strings"
"sync"
"time"

"github.com/fatih/color"
Expand Down Expand Up @@ -109,6 +110,27 @@ func SectorsStatusCmd(getActorAddress ActorAddressGetter, getOnDiskInfo OnDiskIn
fmt.Printf("OnTime:\t\t%v\n", status.OnTime)
fmt.Printf("Early:\t\t%v\n", status.Early)

var pamsHeaderOnce sync.Once

for pi, piece := range status.Pieces {
if piece.DealInfo == nil {
continue
}
if piece.DealInfo.PieceActivationManifest == nil {
continue
}
pamsHeaderOnce.Do(func() {
fmt.Printf("\nPiece Activation Manifests\n")
})

pam := piece.DealInfo.PieceActivationManifest

fmt.Printf("Piece %d: %s %s verif-alloc:%+v\n", pi, pam.CID, types.SizeStr(types.NewInt(uint64(pam.Size))), pam.VerifiedAllocationKey)
for ni, notification := range pam.Notify {
fmt.Printf("\tNotify %d: %s (%x)\n", ni, notification.Address, notification.Payload)
}
}

} else {
onChainInfo = true
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/lotus-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ var sectorsListCmd = &cli.Command{
}
}

var pams int
for _, p := range st.Pieces {
if p.DealInfo != nil && p.DealInfo.PieceActivationManifest != nil {
pams++
}
}

exp := st.Expiration
if st.OnTime > 0 && st.OnTime < exp {
exp = st.OnTime // Can be different when the sector was CC upgraded
Expand All @@ -324,6 +331,8 @@ var sectorsListCmd = &cli.Command{

if deals > 0 {
m["Deals"] = color.GreenString("%d", deals)
} else if pams > 0 {
m["Deals"] = color.MagentaString("DDO:%d", pams)
} else {
m["Deals"] = color.BlueString("CC")
if st.ToUpgrade {
Expand Down

0 comments on commit 83421e2

Please sign in to comment.