forked from Qitmeer/qng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbehaviorflags.go
33 lines (25 loc) · 975 Bytes
/
behaviorflags.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
package blockchain
// BehaviorFlags is a bitmask defining tweaks to the normal behavior when
// performing chain processing and consensus rules checks.
type BehaviorFlags uint32
const (
// BFFastAdd may be set to indicate that several checks can be avoided
// for the block since it is already known to fit into the chain due to
// already proving it correct links into the chain up to a known
// checkpoint. This is primarily used for headers-first mode.
BFFastAdd BehaviorFlags = 1 << iota
// BFNoPoWCheck may be set to indicate the proof of work check which
// ensures a block hashes to a value less than the required target will
// not be performed.
BFNoPoWCheck
BFP2PAdd
// Add block from RPC interface
BFRPCAdd
// Add block from broadcast interface
BFBroadcast
// BFNone is a convenience value to specifically indicate no flags.
BFNone BehaviorFlags = 0
)
func (bf BehaviorFlags) Has(value BehaviorFlags) bool {
return (bf & value) == value
}