The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/consensus/consensus_fbft.go

30 lines
493 B

package consensus
import "sync"
type LockedFBFTPhase struct {
mu sync.Mutex
phase FBFTPhase
}
func NewLockedFBFTPhase(initialPhrase FBFTPhase) *LockedFBFTPhase {
return &LockedFBFTPhase{
phase: initialPhrase,
}
}
func (a *LockedFBFTPhase) Set(phrase FBFTPhase) {
a.mu.Lock()
a.phase = phrase
a.mu.Unlock()
}
func (a *LockedFBFTPhase) Get() FBFTPhase {
a.mu.Lock()
defer a.mu.Unlock()
return a.phase
}
func (a *LockedFBFTPhase) String() string {
return a.Get().String()
}