consensus reactor code polish, fixed prs BitArray cache invalidation bug

This commit is contained in:
Jae Kwon
2015-07-05 13:40:59 -07:00
parent bc71e38bad
commit 41d04cf5b8
4 changed files with 219 additions and 138 deletions

View File

@ -67,6 +67,14 @@ func (voteSet *VoteSet) Round() int {
}
}
func (voteSet *VoteSet) Type() byte {
if voteSet == nil {
return 0x00
} else {
return voteSet.type_
}
}
func (voteSet *VoteSet) Size() int {
if voteSet == nil {
return 0
@ -193,6 +201,15 @@ func (voteSet *VoteSet) HasTwoThirdsMajority() bool {
return voteSet.maj23Exists
}
func (voteSet *VoteSet) IsCommit() bool {
if voteSet == nil {
return false
}
voteSet.mtx.Lock()
defer voteSet.mtx.Unlock()
return len(voteSet.maj23Hash) > 0
}
func (voteSet *VoteSet) HasTwoThirdsAny() bool {
if voteSet == nil {
return false