fix staging area path buildup

This commit is contained in:
Anton Evangelatov 2021-09-21 16:45:00 +02:00
parent 2437a4182d
commit c7e4217693

View File

@ -70,7 +70,10 @@ import (
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
) )
var StorageCounterDSPrefix = "/storage/nextid" var (
StorageCounterDSPrefix = "/storage/nextid"
StagingAreaDirName = "deal-staging"
)
func minerAddrFromDS(ds dtypes.MetadataDS) (address.Address, error) { func minerAddrFromDS(ds dtypes.MetadataDS) (address.Address, error) {
maddrb, err := ds.Get(datastore.NewKey("miner-address")) maddrb, err := ds.Get(datastore.NewKey("miner-address"))
@ -536,7 +539,8 @@ func BasicDealFilter(cfg config.DealmakingConfig, user dtypes.StorageDealFilter)
return false, "miner error", err return false, "miner error", err
} }
diskUsageBytes, err := r.DiskUsage(r.Path() + "/deal-staging") dir := filepath.Join(r.Path(), StagingAreaDirName)
diskUsageBytes, err := r.DiskUsage(dir)
if err != nil { if err != nil {
return false, "miner error", err return false, "miner error", err
} }
@ -574,7 +578,7 @@ func StorageProvider(minerAddress dtypes.MinerAddress,
) (storagemarket.StorageProvider, error) { ) (storagemarket.StorageProvider, error) {
net := smnet.NewFromLibp2pHost(h) net := smnet.NewFromLibp2pHost(h)
dir := filepath.Join(r.Path(), "deal-staging") dir := filepath.Join(r.Path(), StagingAreaDirName)
// migrate temporary files that were created directly under the repo, by // migrate temporary files that were created directly under the repo, by
// moving them to the new directory and symlinking them. // moving them to the new directory and symlinking them.