github.com/fozzysec/SiaPrime@v0.0.0-20190612043147-66c8e8d11fe3/modules/renter/proto/consts.go (about) 1 package proto 2 3 import ( 4 "time" 5 6 "SiaPrime/build" 7 "SiaPrime/crypto" 8 "SiaPrime/modules" 9 ) 10 11 const ( 12 // contractExtension is the extension given to contract files. 13 contractExtension = ".contract" 14 15 // rootsDiskLoadBulkSize is the max number of roots we read from disk at 16 // once to avoid using up all the ram. 17 rootsDiskLoadBulkSize = 1024 * crypto.HashSize // 32 kib 18 19 // remainingFile is a constant used to indicate that a fileSection can access 20 // the whole remaining file instead of being bound to a certain end offset. 21 remainingFile = -1 22 ) 23 24 var ( 25 // connTimeout determines the number of seconds before a dial-up or 26 // revision negotiation times out. 27 connTimeout = build.Select(build.Var{ 28 Dev: 10 * time.Second, 29 Standard: 2 * time.Minute, 30 Testing: 5 * time.Second, 31 }).(time.Duration) 32 33 // hostPriceLeeway is the amount of flexibility we give to hosts when 34 // choosing how much to pay for file uploads. If the host does not have the 35 // most recent block yet, the host will be expecting a slightly larger 36 // payment. 37 // 38 // TODO: Due to the network connectivity issues that v1.3.0 introduced, we 39 // had to increase the amount moderately because hosts would not always be 40 // properly connected to the peer network, and so could fall behind on 41 // blocks. Once enough of the network has upgraded, we can move the number 42 // to '0.003' for 'Standard'. 43 hostPriceLeeway = build.Select(build.Var{ 44 Dev: 0.05, 45 Standard: 0.01, 46 Testing: 0.002, 47 }).(float64) 48 49 // sectorHeight is the height of a Merkle tree that covers a single 50 // sector. It is log2(modules.SectorSize / crypto.SegmentSize) 51 sectorHeight = func() uint64 { 52 height := uint64(0) 53 for 1<<height < (modules.SectorSize / crypto.SegmentSize) { 54 height++ 55 } 56 return height 57 }() 58 )