Class Proposal
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Implements
Inherited Members
Namespace: Libplanet.Consensus
Assembly: Libplanet.dll
Syntax
public class Proposal : IEquatable<Proposal>
Constructors
| Improve this Doc View SourceProposal(Dictionary)
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
public Proposal(Dictionary encoded)
Parameters
Type | Name | Description |
---|---|---|
Bencodex.Types.Dictionary | encoded |
Proposal(ProposalMetadata, ImmutableArray<Byte>)
Instantiates a Proposal with given proposalMetadata
and its signature
.
Declaration
public Proposal(ProposalMetadata proposalMetadata, ImmutableArray<byte> signature)
Parameters
Type | Name | Description |
---|---|---|
ProposalMetadata | proposalMetadata | A ProposalMetadata to propose. |
ImmutableArray<Byte> | signature | A signature signed with |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if given |
ArgumentException | Thrown if given |
Proposal(Byte[])
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
public Proposal(byte[] marshaled)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | marshaled |
Properties
| Improve this Doc View SourceBlockHash
The BlockHash of MarshaledBlock. This is automatically derived from MarshaledBlock.
Declaration
public BlockHash BlockHash { get; }
Property Value
Type | Description |
---|---|
BlockHash |
ByteArray
Declaration
public ImmutableArray<byte> ByteArray { get; }
Property Value
Type | Description |
---|---|
ImmutableArray<Byte> |
Encoded
A Bencodex-encoded value of Proposal.
Declaration
[JsonIgnore]
public Dictionary Encoded { get; }
Property Value
Type | Description |
---|---|
Bencodex.Types.Dictionary |
Height
A height of given proposal values.
Declaration
public long Height { get; }
Property Value
Type | Description |
---|---|
Int64 |
MarshaledBlock
A marshaled bencodex-encoded Byte array of block.
Declaration
public byte[] MarshaledBlock { get; }
Property Value
Type | Description |
---|---|
Byte[] |
Round
A round of given proposal values.
Declaration
public int Round { get; }
Property Value
Type | Description |
---|---|
Int32 |
Signature
A signature that signed with ProposalMetadata.
Declaration
public ImmutableArray<byte> Signature { get; }
Property Value
Type | Description |
---|---|
ImmutableArray<Byte> |
Timestamp
The time at which the proposal took place.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
ValidatorPublicKey
A PublicKey of proposing validator.
Declaration
public PublicKey ValidatorPublicKey { get; }
Property Value
Type | Description |
---|---|
PublicKey |
ValidRound
a latest valid round at the moment of given proposal.
Declaration
public int ValidRound { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceEquals(Proposal)
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
[Pure]
public bool Equals(Proposal other)
Parameters
Type | Name | Description |
---|---|---|
Proposal | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
[Pure]
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
[Pure]
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceToByteArray()
Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
Byte[] |
Verify()
Verifies whether the ProposalMetadata is properly signed by Validator.
Declaration
[Pure]
public bool Verify()
Returns
Type | Description |
---|---|
Boolean | true if the Signature is not empty and is a valid signature signed by Validator. |