Show / Hide Table of Contents

Class BlockPolicy<T>

A default implementation of IBlockPolicy<T> interface.

Inheritance
Object
BlockPolicy<T>
Implements
IBlockPolicy<T>
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Blockchain.Policies
Assembly: Libplanet.dll
Syntax
public class BlockPolicy<T> : IBlockPolicy<T> where T : IAction, new()
Type Parameters
Name Description
T

An IAction type. It should match to Block<T>'s type parameter.

Constructors

| Improve this Doc View Source

BlockPolicy(Int32)

Creates a BlockPolicy<T> with configuring BlockInterval in milliseconds.

Declaration
public BlockPolicy(int blockIntervalMilliseconds = 5000)
Parameters
Type Name Description
Int32 blockIntervalMilliseconds

Configures BlockInterval in milliseconds. 5000 milliseconds by default.

| Improve this Doc View Source

BlockPolicy(TimeSpan)

Creates a BlockPolicy<T> with configuring BlockInterval.

Declaration
public BlockPolicy(TimeSpan blockInterval)
Parameters
Type Name Description
TimeSpan blockInterval

Configures BlockInterval.

Properties

| Improve this Doc View Source

BlockInterval

An appropriate interval between consecutive Block<T>s. It is usually from 20 to 30 seconds.

If a previous interval took longer than this GetNextBlockDifficulty(IEnumerable<Block<T>>) method raises the Difficulty. If it took shorter than this Difficulty is dropped.

Declaration
public TimeSpan BlockInterval { get; }
Property Value
Type Description
TimeSpan

Methods

| Improve this Doc View Source

GetNextBlockDifficulty(IEnumerable<Block<T>>)

Declaration
public int GetNextBlockDifficulty(IEnumerable<Block<T>> blocks)
Parameters
Type Name Description
IEnumerable<Block<T>> blocks
Returns
Type Description
Int32
| Improve this Doc View Source

ValidateBlocks(IEnumerable<Block<T>>, DateTimeOffset)

Declaration
public InvalidBlockException ValidateBlocks(IEnumerable<Block<T>> blocks, DateTimeOffset currentTime)
Parameters
Type Name Description
IEnumerable<Block<T>> blocks
DateTimeOffset currentTime
Returns
Type Description
InvalidBlockException

Implements

IBlockPolicy<T>
  • Improve this Doc
  • View Source
Back to top Copyright © 2019 Planetarium
Generated by DocFX