Class VoteSet
Inherited Members
Namespace: Libplanet.Net.Consensus
Assembly: Libplanet.Net.dll
Syntax
public class VoteSet
Constructors
| Improve this Doc View SourceVoteSet(Int64, Int32, VoteFlag, ValidatorSet)
Declaration
public VoteSet(long height, int round, VoteFlag voteType, ValidatorSet validatorSet)
Parameters
Type | Name | Description |
---|---|---|
Int64 | height | |
Int32 | round | |
Vote |
voteType | |
Validator |
validatorSet |
Properties
| Improve this Doc View SourceCount
Count of the canonical Votes.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Sum
Declaration
public BigInteger Sum { get; }
Property Value
Type | Description |
---|---|
Big |
TotalCount
Count of the all Votes.
Declaration
public int TotalCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Validators
Declaration
public IEnumerable<Validator> Validators { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Validator> |
Methods
| Improve this Doc View SourceBitArray()
Declaration
public bool[] BitArray()
Returns
Type | Description |
---|---|
Boolean[] |
BitArrayByBlockHash(BlockHash)
Declaration
public bool[] BitArrayByBlockHash(BlockHash blockHash)
Parameters
Type | Name | Description |
---|---|---|
Block |
blockHash |
Returns
Type | Description |
---|---|
Boolean[] |
Contains(PublicKey, BlockHash)
Predicate indicates where the VotepublicKey
and blockHash
.
Declaration
public bool Contains(PublicKey publicKey, BlockHash blockHash)
Parameters
Returns
Type | Description |
---|---|
Boolean | true when a vote with given params exits, else false. |
GetAllVotes()
Gets all collected Votes.
Declaration
public IEnumerable<Vote> GetAllVotes()
Returns
Type | Description |
---|---|
IEnumerable<Vote> | IEnumerable<T> of Vote. |
GetByPublicKey(PublicKey)
Gets the Vote signed by given publicKey
.
If given validator has conflicting votes, returns "canonical" Vote.
Declaration
public Vote GetByPublicKey(PublicKey publicKey)
Parameters
Returns
Exceptions
Type | Condition |
---|---|
Key |
Thrown when there's no Vote
signed by given |
GetVote(PublicKey, BlockHash)
Gets a Vote signed by publicKey
and of hash
blockHash
.
Declaration
public Vote GetVote(PublicKey publicKey, BlockHash blockHash)
Parameters
Returns
| Improve this Doc View SourceGetVotes(BlockHash)
Gets all collected Votes that voted to block with hash
blockHash
.
Declaration
public IEnumerable<Vote> GetVotes(BlockHash blockHash)
Parameters
Returns
Type | Description |
---|---|
IEnumerable<Vote> | IEnumerable<T> of Vote. |
HasAll()
Predicate which returns true when collected all Votes. Else, return false.
Declaration
public bool HasAll()
Returns
| Improve this Doc View SourceHasOneThirdsAny()
If there is a +1/3 majority for any Block
Declaration
public bool HasOneThirdsAny()
Returns
Type | Description |
---|---|
Boolean | true if +1/3 majority exists, else false. |
HasTwoThirdsAny()
If there is a +2/3 majority for any Block
Declaration
public bool HasTwoThirdsAny()
Returns
Type | Description |
---|---|
Boolean | true if +2/3 majority exists, else false. |
HasTwoThirdsMajority()
If there is a +2/3 majority for certain Block
Declaration
public bool HasTwoThirdsMajority()
Returns
Type | Description |
---|---|
Boolean | true if +2/3 majority exists, else false. |
IsCommit()
A predicate indicates whether the Vote
Declaration
public bool IsCommit()
Returns
| Improve this Doc View SourceList()
Declaration
public List<Vote> List()
Returns
| Improve this Doc View SourceMappedList()
Returns a copy of the list of Votes stored by the Vote
Declaration
public List<Vote> MappedList()
Returns
Type | Description |
---|---|
List<Vote> | A copy of the list of Votes stored by the Vote |
Exceptions
Type | Condition |
---|---|
Null |
Thrown when there are no +2/3 majority Votes. |
SetPeerMaj23(Maj23)
If a peer claims that it has 2/3 majority for given Block
Declaration
public bool SetPeerMaj23(Maj23 maj23)
Parameters
Returns
Remarks
if there are too many peers, or too much peer churn, this can cause memory issues.
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when given |
ToBlockCommit()
Create a Block
Declaration
public BlockCommit ToBlockCommit()
Returns
Type | Description |
---|---|
Block |
A Block |
TwoThirdsMajority(out BlockHash)
If there is a +2/3 majority for certain Block
Declaration
public bool TwoThirdsMajority(out BlockHash blockHash)
Parameters
Type | Name | Description |
---|---|---|
Block |
blockHash | Block |
Returns
Type | Description |
---|---|
Boolean | true if +2/3 majority exists, else false. |