From 0b7793a927e6358e68ce575fb04f8841bd61467b Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 6 Sep 2021 15:52:25 +0200 Subject: [PATCH] GiB to Bytes --- node/config/doc_gen.go | 6 +++--- node/config/types.go | 6 +++--- node/modules/storageminer.go | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index aae4b3c08..29b182490 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -253,11 +253,11 @@ message`, as a multiplier of the minimum collateral bound`, }, { - Name: "MaxStagingDealsGiB", + Name: "MaxStagingDealsBytes", Type: "int64", - Comment: `The maximum size of staging deals not yet passed to the sealing node, -that the markets service can accept`, + Comment: `The maximum allowed disk usage size in bytes of staging deals not yet +passed to the sealing node by the markets service`, }, { Name: "SimultaneousTransfers", diff --git a/node/config/types.go b/node/config/types.go index 7d56ddac1..3c548301e 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -126,9 +126,9 @@ type DealmakingConfig struct { // The maximum collateral that the provider will put up against a deal, // as a multiplier of the minimum collateral bound MaxProviderCollateralMultiplier uint64 - // The maximum size of staging deals not yet passed to the sealing node, - // that the markets service can accept - MaxStagingDealsGiB int64 + // The maximum allowed disk usage size in bytes of staging deals not yet + // passed to the sealing node by the markets service + MaxStagingDealsBytes int64 // The maximum number of parallel online data transfers (storage+retrieval) SimultaneousTransfers uint64 diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index fb2061ecd..a4fc1d347 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -542,9 +542,8 @@ func BasicDealFilter(cfg config.DealmakingConfig, user dtypes.StorageDealFilter) return false, "miner error", err } - diskUsageGiB := diskUsageBytes / 1024 / 1024 / 1024 - if cfg.MaxStagingDealsGiB != 0 && diskUsageGiB >= cfg.MaxStagingDealsGiB { - log.Errorw("proposed deal rejected because there are too many deals in the staging area at the moment", "MaxStagingDealsGiB", cfg.MaxStagingDealsGiB, "DiskUsageGiB", diskUsageGiB) + if cfg.MaxStagingDealsBytes != 0 && diskUsageBytes >= cfg.MaxStagingDealsBytes { + log.Errorw("proposed deal rejected because there are too many deals in the staging area at the moment", "MaxStagingDealsBytes", cfg.MaxStagingDealsBytes, "DiskUsageBytes", diskUsageBytes) return false, "cannot accept deal as miner is overloaded at the moment - there are too many staging deals being processed", nil }