Class ConsensusReactor
A manager class for starting network and joining into consensus. Libplanet.Net.Consensus.ConsensusReactor.ConsensusContext
Inherited Members
Namespace: Libplanet.Net.Consensus
Assembly: Libplanet.Net.dll
Syntax
public class ConsensusReactor : IReactor, IDisposable
Constructors
| Improve this Doc View SourceConsensusReactor(ITransport, BlockChain, PrivateKey, ImmutableList<BoundPeer>, ImmutableList<BoundPeer>, TimeSpan, ContextTimeoutOption)
Initializes a new instance of the ConsensusReactor class.
Declaration
public ConsensusReactor(ITransport consensusTransport, BlockChain blockChain, PrivateKey privateKey, ImmutableList<BoundPeer> validatorPeers, ImmutableList<BoundPeer> seedPeers, TimeSpan newHeightDelay, ContextTimeoutOption contextTimeoutOption)
Parameters
Type | Name | Description |
---|---|---|
ITransport | consensusTransport | An ITransport for sending the ConsensusMsgs to validators. |
BlockChain | blockChain | A blockchain that will be committed, which will be voted by consensus, and used for proposing a block. |
PrivateKey | privateKey | A PrivateKey for using in signing a block, message. |
ImmutableList<BoundPeer> | validatorPeers | A list of validator's BoundPeer, including itself. |
ImmutableList<BoundPeer> | seedPeers | A list of seed's BoundPeer. |
TimeSpan | newHeightDelay | A time delay in starting the consensus for the next height block. |
ContextTimeoutOption | contextTimeoutOption | A ContextTimeoutOption for configuring a timeout for each ConsensusStep. |
Properties
| Improve this Doc View SourceHeight
The index of block that Libplanet.Net.Consensus.ConsensusReactor.ConsensusContext is watching. The value can be changed by starting a consensus or appending a block.
Declaration
public long Height { get; }
Property Value
Type | Description |
---|---|
Int64 |
Running
Whether this ConsensusReactor is running.
Declaration
public bool Running { get; }
Property Value
Type | Description |
---|---|
Boolean |
Validators
An IEnumerable<T> of the validators.
Declaration
public IReadOnlyList<BoundPeer> Validators { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<BoundPeer> |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
StartAsync(CancellationToken)
Starts the instance and joins into consensus.
Declaration
public async Task StartAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | Returns the StartAsync(CancellationToken). |
StopAsync(CancellationToken)
Stops the instance and consensus.
Declaration
public async Task StopAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation Token. |
Returns
Type | Description |
---|---|
Task | Returns the StopAsync(TimeSpan, CancellationToken). |
ToString()
Returns a summary of current consensus status in JSON-formatted string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | Returns a summary in JSON-formatted string. |