/
constants.go
52 lines (40 loc) 路 1.92 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package core
import (
"path"
"time"
"github.com/drand/drand/fs"
)
// DefaultConfigFolderName is the name of the folder containing all key materials
// (and the beacons db file by default). It is relative to the user's home
// directory.
const DefaultConfigFolderName = ".drand"
// DefaultConfigFolder returns the default path of the configuration folder.
func DefaultConfigFolder() string {
return path.Join(fs.HomeFolder(), DefaultConfigFolderName)
}
// DefaultDBFolder is the name of the folder in which the db file is saved.
// It is relative to the DefaultConfigFolder path.
const DefaultDBFolder = "db"
// DefaultBeaconPeriod is the period in which the beacon logic creates new
// random beacon.
const DefaultBeaconPeriod = 1 * time.Minute
// DefaultControlPort is the default port the functionality control port communicate on.
const DefaultControlPort = "8888"
// DefaultDKGTimeout is the default time of each DKG period by default. Note
// that by default, DKG uses the "fast sync" mode that shorten the first phase
// and the second phase, "as fast as possible" when the protocol runs smoothly
// (there is no malicious party).
const DefaultDKGTimeout = 10 * time.Second
// MaxWaitPrepareDKG is the maximum time the "automatic" setting up of the group
// can take. If the setup is still not finished after this time, it is
// canceled.
var MaxWaitPrepareDKG = 24 * 7 * 2 * time.Hour
// DefaultGenesisOffset is the time the leader adds after the maximum DKG time
// (the full three phases) to compute the genesis time of the randomness chain.
const DefaultGenesisOffset = 1 * time.Second
// DefaultResharingOffset is the time the leader adds to the current time to set
// the TransitionTime field in the group file when setting up a resharing. This
// time will be rounded up to the next round time of the beacon, since a beacon
// has to keep the same period.
var DefaultResharingOffset = 30 * time.Second
const callMaxTimeout = 10 * time.Second