github.com/fozzysec/SiaPrime@v0.0.0-20190612043147-66c8e8d11fe3/modules/miningpool/consts.go (about)

     1  package pool
     2  
     3  import (
     4  	"SiaPrime/build"
     5  	"SiaPrime/modules"
     6  
     7  	"time"
     8  )
     9  
    10  const (
    11  	// Names of the various persistent files in the pool.
    12  	dbFilename   = modules.PoolDir + ".db"
    13  	logFile      = modules.PoolDir + ".log"
    14  	dblogFile   = "db.log"
    15  	settingsFile = modules.PoolDir + ".json"
    16  	// MajorVersion is the significant version of the pool module
    17  	MajorVersion = 0
    18  	// MinorVersion is the minor version of the pool module
    19  	MinorVersion = 3
    20  	// SiaCoinID is the coin id used by yiimp to associate various records
    21  	// with Siacoin
    22  	SiaCoinID = 1318
    23  	// SiaCoinSymbol is the coin symbol used by yiimp to associate various records
    24  	// with Siacoin
    25  	SiaCoinSymbol = "SCP"
    26  	// SiaCoinAlgo is the algo used by yiimp to associate various records
    27  	// with blake2b mining
    28  	SiaCoinAlgo = "blake2b"
    29      //PoolName = "IntrepidPool"
    30  )
    31  
    32  var (
    33  	// workingStatusFirstCheck defines how frequently the Pool's working status
    34  	// check runs
    35  	workingStatusFirstCheck = build.Select(build.Var{
    36  		Standard: time.Minute * 3,
    37  		Dev:      time.Minute * 1,
    38  		Testing:  time.Second * 3,
    39  	}).(time.Duration)
    40  
    41  	// workingStatusFrequency defines how frequently the Pool's working status
    42  	// check runs
    43  	workingStatusFrequency = build.Select(build.Var{
    44  		Standard: time.Minute * 10,
    45  		Dev:      time.Minute * 5,
    46  		Testing:  time.Second * 10,
    47  	}).(time.Duration)
    48  
    49  	// workingStatusThreshold defines how many settings calls must occur over the
    50  	// workingStatusFrequency for the pool to be considered working.
    51  	workingStatusThreshold = build.Select(build.Var{
    52  		Standard: uint64(3),
    53  		Dev:      uint64(1),
    54  		Testing:  uint64(1),
    55  	}).(uint64)
    56  
    57  	// connectablityCheckFirstWait defines how often the pool's connectability
    58  	// check is run.
    59  	connectabilityCheckFirstWait = build.Select(build.Var{
    60  		Standard: time.Minute * 2,
    61  		Dev:      time.Minute * 1,
    62  		Testing:  time.Second * 3,
    63  	}).(time.Duration)
    64  
    65  	// connectablityCheckFrequency defines how often the pool's connectability
    66  	// check is run.
    67  	connectabilityCheckFrequency = build.Select(build.Var{
    68  		Standard: time.Minute * 10,
    69  		Dev:      time.Minute * 5,
    70  		Testing:  time.Second * 10,
    71  	}).(time.Duration)
    72  
    73  	// connectabilityCheckTimeout defines how long a connectability check's dial
    74  	// will be allowed to block before it times out.
    75  	connectabilityCheckTimeout = build.Select(build.Var{
    76  		Standard: time.Minute * 2,
    77  		Dev:      time.Minute * 5,
    78  		Testing:  time.Second * 90,
    79  	}).(time.Duration)
    80  
    81  	// logAllLimit is the number of errors of each type that the host will log
    82  	// before switching to probabilistic logging. If there are not many errors,
    83  	// it is reasonable that all errors get logged. If there are lots of
    84  	// errors, to cut down on the noise only some of the errors get logged.
    85  	logAllLimit = build.Select(build.Var{
    86  		Dev:      uint64(50),
    87  		Standard: uint64(250),
    88  		Testing:  uint64(100),
    89  	}).(uint64)
    90  
    91  	// logFewLimit is the number of errors of each type that the host will log
    92  	// before substantially constricting the amount of logging that it is
    93  	// doing.
    94  	logFewLimit = build.Select(build.Var{
    95  		Dev:      uint64(500),
    96  		Standard: uint64(2500),
    97  		Testing:  uint64(500),
    98  	}).(uint64)
    99  
   100  	// rpcRatelimit prevents someone from spamming the pool with connections,
   101  	// causing it to spin up enough goroutines to crash.
   102  	rpcRatelimit = build.Select(build.Var{
   103  		Dev:      time.Millisecond * 10,
   104  		Standard: time.Millisecond * 50,
   105  		Testing:  time.Millisecond,
   106  	}).(time.Duration)
   107  )
   108  
   109  // All of the following variables define the names of buckets used by the pool
   110  // in the database.
   111  var (
   112  	// bucketActionItems maps a blockchain height to a list of storage
   113  	// obligations that need to be managed in some way at that height. The
   114  	// height is stored as a big endian uint64, which means that bolt will
   115  	// store the heights sorted in numerical order. The action item itself is
   116  	// an array of file contract ids. The host is able to contextually figure
   117  	// out what the necessary actions for that item are based on the file
   118  	// contract id and the associated storage obligation that can be retrieved
   119  	// using the id.
   120  	bucketActionItems = []byte("BucketActionItems")
   121  
   122  	// bucketStorageObligations contains a set of serialized
   123  	// 'storageObligations' sorted by their file contract id.
   124  	bucketStorageObligations = []byte("BucketStorageObligations")
   125  )
   126  
   127  // init runs a series of sanity checks to verify that the constants have sane
   128  // values.
   129  func init() {
   130  }