OSDN Git Service

new repo
[bytom/vapor.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         // SFSPV indicate peer support spv mode
13         SFSPV
14         // DefaultServices is the server that this node support
15         DefaultServices = SFFullNode | SFFastSync | SFSPV
16 )
17
18 // IsEnable check does the flag support the input flag function
19 func (f ServiceFlag) IsEnable(checkFlag ServiceFlag) bool {
20         return f&checkFlag == checkFlag
21 }