From 7c22dabb6367aa0c05872993f4c3fb367f0bfaa0 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 23 Apr 2020 18:48:23 -0400 Subject: [PATCH] default to setting max piece size to sector size --- node/modules/storageminer.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index e23a576cc..261bbb108 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -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