correct json parsing of addr

This commit is contained in:
zenground0 2023-07-10 15:54:07 -06:00
parent 921e5520ea
commit 921bdb85ab

View File

@ -26,7 +26,7 @@ var cronWcCmd = &cli.Command{
} }
type DeadlineRef struct { type DeadlineRef struct {
Addr address.Address AddrStr string
Height abi.ChainEpoch Height abi.ChainEpoch
} }
@ -89,19 +89,22 @@ var minerDeadlinePartitionMeasurementCmd = &cli.Command{
if err != nil { if err != nil {
return xerrors.Errorf("failed to get tipset at epoch %d: %w", ref.Height, err) return xerrors.Errorf("failed to get tipset at epoch %d: %w", ref.Height, err)
} }
fmt.Printf("ref: %v\n", ref) addr, err := address.NewFromString(ref.AddrStr)
dline, err := n.StateMinerProvingDeadline(ctx, ref.Addr, tsBefore.Key()) if err != nil {
return xerrors.Errorf("faield to get address from input string: %w", err)
}
dline, err := n.StateMinerProvingDeadline(ctx, addr, tsBefore.Key())
if err != nil { if err != nil {
return xerrors.Errorf("failed to read proving deadline: %w", err) return xerrors.Errorf("failed to read proving deadline: %w", err)
} }
// iterate through all partitions at epoch of processing // iterate through all partitions at epoch of processing
var pSummaries []PartitionSummary var pSummaries []PartitionSummary
psBefore, err := n.StateMinerPartitions(ctx, ref.Addr, dline.Index, tsBefore.Key()) psBefore, err := n.StateMinerPartitions(ctx, addr, dline.Index, tsBefore.Key())
if err != nil { if err != nil {
return xerrors.Errorf("failed to get partitions: %w", err) return xerrors.Errorf("failed to get partitions: %w", err)
} }
psAfter, err := n.StateMinerPartitions(ctx, ref.Addr, dline.Index, tsAfter.Key()) psAfter, err := n.StateMinerPartitions(ctx, addr, dline.Index, tsAfter.Key())
if err != nil { if err != nil {
return xerrors.Errorf("failed to get partitions: %w", err) return xerrors.Errorf("failed to get partitions: %w", err)
} }