BitArray returns a BitArray of which validators voted for BlockID or nil in this commit. Implements VoteSetReader.
()
| 839 | // BitArray returns a BitArray of which validators voted for BlockID or nil in this commit. |
| 840 | // Implements VoteSetReader. |
| 841 | func (commit *Commit) BitArray() *bits.BitArray { |
| 842 | if commit.bitArray == nil { |
| 843 | commit.bitArray = bits.NewBitArray(len(commit.Signatures)) |
| 844 | for i, commitSig := range commit.Signatures { |
| 845 | // TODO: need to check the BlockID otherwise we could be counting conflicts, |
| 846 | // not just the one with +2/3 ! |
| 847 | commit.bitArray.SetIndex(i, !commitSig.Absent()) |
| 848 | } |
| 849 | } |
| 850 | return commit.bitArray |
| 851 | } |
| 852 | |
| 853 | // GetByIndex returns the vote corresponding to a given validator index. |
| 854 | // Panics if `index >= commit.Size()`. |
nothing calls this directly
no test coverage detected