Class VoteMetadata
Represents a vote metadata from a validator for consensus.
Inherited Members
Namespace: Libplanet.Types.Consensus
Assembly: Libplanet.Types.dll
Syntax
public class VoteMetadata : IVoteMetadata, IEquatable<VoteMetadata>, IBencodable
Constructors
| Improve this Doc View SourceVoteMetadata(IValue)
Represents a vote metadata from a validator for consensus.
Declaration
public VoteMetadata(IValue bencoded)
Parameters
Type | Name | Description |
---|---|---|
Bencodex.Types.IValue | bencoded |
VoteMetadata(Int64, Int32, BlockHash, DateTimeOffset, PublicKey, VoteFlag)
Creates a VoteMetadata instance.
Declaration
public VoteMetadata(long height, int round, BlockHash blockHash, DateTimeOffset timestamp, PublicKey validatorPublicKey, VoteFlag flag)
Parameters
Type | Name | Description |
---|---|---|
Int64 | height | Height of the vote target block. |
Int32 | round | Round of the vote in given height. |
BlockHash | blockHash | BlockHash of the block in vote. |
DateTimeOffset | timestamp | The time at which the voting took place. |
PublicKey | validatorPublicKey | PublicKey of the validator made the vote. |
VoteFlag | flag | VoteFlag for the vote's status. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown for any of the following reasons: |
Properties
| Improve this Doc View SourceBencoded
Represents a vote metadata from a validator for consensus.
Declaration
[JsonIgnore]
public IValue Bencoded { get; }
Property Value
Type | Description |
---|---|
Bencodex.Types.IValue |
BlockHash
BlockHash of the block in vote. If default, vote nil.
Declaration
public BlockHash BlockHash { get; }
Property Value
Type | Description |
---|---|
BlockHash |
Flag
Declaration
public VoteFlag Flag { get; }
Property Value
Type | Description |
---|---|
VoteFlag |
Height
Height of the vote target block.
Declaration
public long Height { get; }
Property Value
Type | Description |
---|---|
Int64 |
Round
Round of the vote in given height.
Declaration
public int Round { get; }
Property Value
Type | Description |
---|---|
Int32 |
Timestamp
The time at which the voting took place.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
ValidatorPublicKey
The PublicKey of the validator that voted.
Declaration
public PublicKey ValidatorPublicKey { get; }
Property Value
Type | Description |
---|---|
PublicKey |
Methods
| Improve this Doc View SourceEquals(VoteMetadata)
Represents a vote metadata from a validator for consensus.
Declaration
public bool Equals(VoteMetadata other)
Parameters
Type | Name | Description |
---|---|---|
VoteMetadata | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Represents a vote metadata from a validator for consensus.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Represents a vote metadata from a validator for consensus.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceSign(PrivateKey)
Signs a VoteMetadata to create a Vote
using given signer
.
Declaration
public Vote Sign(PrivateKey signer)
Parameters
Type | Name | Description |
---|---|---|
PrivateKey | signer | The PrivateKey to sign the data with. This can be null to create an unsigned Vote instance. |
Returns
Type | Description |
---|---|
Vote | A Vote with a (possibly null) signature. |