OSDN Git Service

5346026354fac866b3d3aaaefe6a09e529d792fb
[bytom/bytom.git] / consensus / server_flag.go
1 package consensus
2
3 // ServiceFlag use uint64 to indicate what kind of server this node can provide.
4 // one uint64 can represent 64 type of service flag
5 type ServiceFlag uint64
6
7 const (
8         // SFFullNode is a flag used to indicate a peer is a full node.
9         SFFullNode ServiceFlag = 1 << iota
10         // SFFastSync indicate peer support header first mode
11         SFFastSync
12         // DefaultServices is the server that this node support
13         DefaultServices = SFFullNode | SFFastSync
14 )
15
16 // IsEnable check does the flag support the input flag function
17 func (f ServiceFlag) IsEnable(checkFlag ServiceFlag) bool {
18         return f&checkFlag == checkFlag
19 }