github.com/dmmcquay/sia@v1.3.1-0.20180712220038-9f8d535311b9/modules/renter/contractor/consts.go (about)

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