gitlab.com/jokerrs1/Sia@v1.3.2/modules/renter/contractor/consts.go (about)

     1  package contractor
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/NebulousLabs/Sia/build"
     7  	"github.com/NebulousLabs/Sia/modules"
     8  	"github.com/NebulousLabs/Sia/types"
     9  )
    10  
    11  // Constants related to contract formation parameters.
    12  var (
    13  	// To alleviate potential block propagation issues, the contractor sleeps
    14  	// between each contract formation.
    15  	contractFormationInterval = build.Select(build.Var{
    16  		Dev:      10 * time.Second,
    17  		Standard: 60 * time.Second,
    18  		Testing:  10 * time.Millisecond,
    19  	}).(time.Duration)
    20  
    21  	// minContractFundRenewalThreshold defines the ratio of remaining funds to
    22  	// total contract cost below which the contractor will prematurely renew a
    23  	// contract.
    24  	minContractFundRenewalThreshold = float64(0.03) // 3%
    25  
    26  	// minScoreHostBuffer defines how many extra hosts are queried when trying
    27  	// to figure out an appropriate minimum score for the hosts that we have.
    28  	minScoreHostBuffer = build.Select(build.Var{
    29  		Dev:      2,
    30  		Standard: 10,
    31  		Testing:  1,
    32  	}).(int)
    33  )
    34  
    35  // Constants related to the safety values for when the contractor is forming
    36  // contracts.
    37  var (
    38  	maxCollateral    = types.SiacoinPrecision.Mul64(1e3) // 1k SC
    39  	maxDownloadPrice = maxStoragePrice.Mul64(3 * 4320)
    40  	maxStoragePrice  = types.SiacoinPrecision.Mul64(30e3).Div(modules.BlockBytesPerMonthTerabyte) // 30k SC / TB / Month
    41  	maxUploadPrice   = maxStoragePrice.Mul64(3 * 4320)                                            // 3 months of storage
    42  
    43  	// scoreLeeway defines the factor by which a host can miss the goal score
    44  	// for a set of hosts. To determine the goal score, a new set of hosts is
    45  	// queried from the hostdb and the lowest scoring among them is selected.
    46  	// That score is then divided by scoreLeeway to get the minimum score that a
    47  	// host is allowed to have before being marked as !GoodForUpload.
    48  	scoreLeeway = types.NewCurrency64(100)
    49  )