Merge pull request #1597 from filecoin-project/asr/misc

Various improvements to deal workflow
This commit is contained in:
Łukasz Magiera 2020-04-24 23:07:33 +02:00 committed by GitHub
commit e8e2b3a6f9
3 changed files with 26 additions and 2 deletions

View File

@ -453,6 +453,7 @@ var clientQueryAskCmd = &cli.Command{
fmt.Printf("Ask: %s\n", maddr)
fmt.Printf("Price per GiB: %s\n", types.FIL(ask.Ask.Price))
fmt.Printf("Max Piece size: %d\n", ask.Ask.MaxPieceSize)
size := cctx.Int64("size")
if size == 0 {

View File

@ -379,7 +379,18 @@ func (n *ClientNodeAdapter) ValidateAskSignature(ctx context.Context, ask *stora
return false, xerrors.Errorf("failed to re-serialize ask")
}
err = sigs.Verify(ask.Signature, mi.Worker, sigb)
ts, err := n.ChainGetTipSet(ctx, tsk)
if err != nil {
return false, xerrors.Errorf("failed to load tipset")
}
m, err := n.StateManager.ResolveToKeyAddress(ctx, mi.Worker, ts)
if err != nil {
return false, xerrors.Errorf("failed to resolve miner to key address")
}
err = sigs.Verify(ask.Signature, m, sigb)
return err == nil, err
}

View File

@ -310,7 +310,19 @@ func StorageProvider(ctx helpers.MetricsCtx, fapi lapi.FullNode, h host.Host, ds
return nil, err
}
return storageimpl.NewProvider(net, ds, ibs, store, pieceStore, dataTransfer, spn, minerAddress, rt)
p, err := storageimpl.NewProvider(net, ds, ibs, store, pieceStore, dataTransfer, spn, minerAddress, rt)
if err != nil {
return p, err
}
// Hacky way to set max piece size to the sector size
a := p.ListAsks(minerAddress)[0].Ask
err = p.AddAsk(a.Price, a.Expiry-a.Timestamp, storagemarket.MaxPieceSize(abi.PaddedPieceSize(mi.SectorSize)))
if err != nil {
return p, err
}
return p, nil
}
// RetrievalProvider creates a new retrieval provider attached to the provider blockstore