Class ValidatorSet
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Inheritance
System.Object
ValidatorSet
Assembly: Libplanet.Types.dll
Syntax
public class ValidatorSet : IEquatable<ValidatorSet>
Constructors
|
Improve this Doc
View Source
ValidatorSet()
Declaration
|
Improve this Doc
View Source
ValidatorSet(Bencodex.Types.IValue)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public ValidatorSet(Bencodex.Types.IValue bencoded)
Parameters
Type |
Name |
Description |
Bencodex.Types.IValue |
bencoded |
|
|
Improve this Doc
View Source
ValidatorSet(List<Validator>)
Declaration
public ValidatorSet(List<Validator> validators)
Parameters
Type |
Name |
Description |
List<Validator> |
validators |
The of validators to use.
|
Properties
|
Improve this Doc
View Source
Bencoded
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public Bencodex.Types.IValue Bencoded { get; }
Property Value
Type |
Description |
Bencodex.Types.IValue |
|
|
Improve this Doc
View Source
Item[Int32]
Gets the validator at given index
.
Declaration
public Validator this[int index] { get; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index to search.
|
Property Value
Type |
Description |
Validator |
The validator at given index .
|
|
Improve this Doc
View Source
OneThirdCount
The one third of validator count, rounded down.
Declaration
public int OneThirdCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
OneThirdPower
The one third of validator total power, rounded down.
Declaration
public BigInteger OneThirdPower { get; }
Property Value
Type |
Description |
BigInteger |
|
|
Improve this Doc
View Source
PublicKeys
An of public keys of validators.
This is guaranteed to be ordered by Address.
Declaration
public ImmutableList<PublicKey> PublicKeys { get; }
Property Value
|
Improve this Doc
View Source
TotalCount
The total number of validators.
Declaration
public int TotalCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
TotalPower
The total power of validators.
Declaration
public BigInteger TotalPower { get; }
Property Value
Type |
Description |
BigInteger |
|
|
Improve this Doc
View Source
TwoThirdsCount
The two thirds of validator count, rounded down.
Declaration
public int TwoThirdsCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
TwoThirdsPower
The two thirds of validator total power, rounded down.
Declaration
public BigInteger TwoThirdsPower { get; }
Property Value
Type |
Description |
BigInteger |
|
|
Improve this Doc
View Source
Validators
An of validators. This is guaranteed to be ordered
by Address.
Declaration
public ImmutableList<Validator> Validators { get; }
Property Value
Methods
|
Improve this Doc
View Source
Contains(Validator)
Declaration
public bool Contains(Validator validator)
Parameters
Returns
Type |
Description |
System.Boolean |
true if given validator
is in Validators, false otherwise.
|
|
Improve this Doc
View Source
ContainsPublicKey(PublicKey)
Declaration
public bool ContainsPublicKey(PublicKey publicKey)
Parameters
Returns
Type |
Description |
System.Boolean |
true if given publicKey
is in Validators, false otherwise.
|
|
Improve this Doc
View Source
Equals(ValidatorSet)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public bool Equals(ValidatorSet other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Equals(Nullable<Object>)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public override bool Equals(object? obj)
Parameters
Type |
Name |
Description |
System.Nullable<System.Object> |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
FindIndex(PublicKey)
Gets the index of given publicKey
.
Declaration
public int FindIndex(PublicKey publicKey)
Parameters
Returns
Type |
Description |
System.Int32 |
The index of given publicKey .
|
|
Improve this Doc
View Source
GetHashCode()
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
GetProposer(Int64, Int32)
Gets the proposer for a given context.
Declaration
public Validator GetProposer(long height, int round)
Parameters
Type |
Name |
Description |
System.Int64 |
height |
The height of the context under consideration.
|
System.Int32 |
round |
The round of the context under consideration.
|
Returns
|
Improve this Doc
View Source
GetValidator(PublicKey)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public Validator GetValidator(PublicKey publicKey)
Parameters
Returns
|
Improve this Doc
View Source
GetValidators(IEnumerable<PublicKey>)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public ImmutableList<Validator> GetValidators(IEnumerable<PublicKey> publicKeys)
Parameters
Type |
Name |
Description |
IEnumerable<PublicKey> |
publicKeys |
|
Returns
|
Improve this Doc
View Source
GetValidatorsPower(List<PublicKey>)
A wrapper class for a of Validators.
This standardizes the ordering of validators by Address.
Declaration
public BigInteger GetValidatorsPower(List<PublicKey> publicKeys)
Parameters
Type |
Name |
Description |
List<PublicKey> |
publicKeys |
|
Returns
Type |
Description |
BigInteger |
|
|
Improve this Doc
View Source
Update(Validator)
Creates a new ValidatorSet that has been updated with
given validator
according to the following rule:
-
If
validator
's power is zero, the Validator
with the same PublicKey is removed, if it exists.
If no matching Validator is found, no change is made.
-
If
validator
's power is positive, the Validator
with the same PublicKey is overwritten, if it exists.
If no matching Validator is found, validator
is added to the set.
Declaration
public ValidatorSet Update(Validator validator)
Parameters
Returns
|
Improve this Doc
View Source
ValidateBlockCommitValidators(BlockCommit)
Declaration
public bool ValidateBlockCommitValidators(BlockCommit blockCommit)
Parameters
Returns
Type |
Description |
System.Boolean |
true if the Votes is
ordered, false otherwise.
|
Implements
IBencodable