|
|
@ -1,9 +1,6 @@ |
|
|
|
package consensus |
|
|
|
package consensus |
|
|
|
|
|
|
|
|
|
|
|
import "sync" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type LockedFBFTPhase struct { |
|
|
|
type LockedFBFTPhase struct { |
|
|
|
mu sync.Mutex |
|
|
|
|
|
|
|
phase FBFTPhase |
|
|
|
phase FBFTPhase |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -14,14 +11,10 @@ func NewLockedFBFTPhase(initialPhrase FBFTPhase) *LockedFBFTPhase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (a *LockedFBFTPhase) Set(phrase FBFTPhase) { |
|
|
|
func (a *LockedFBFTPhase) Set(phrase FBFTPhase) { |
|
|
|
a.mu.Lock() |
|
|
|
|
|
|
|
a.phase = phrase |
|
|
|
a.phase = phrase |
|
|
|
a.mu.Unlock() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (a *LockedFBFTPhase) Get() FBFTPhase { |
|
|
|
func (a *LockedFBFTPhase) Get() FBFTPhase { |
|
|
|
a.mu.Lock() |
|
|
|
|
|
|
|
defer a.mu.Unlock() |
|
|
|
|
|
|
|
return a.phase |
|
|
|
return a.phase |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|