• Design
  • API Reference
  • Changelog
  • Contribute
Show / Hide Table of Contents
  • Libplanet
    • Address
    • AddressExtension
    • ByteUtil
    • Hashcash
    • Hashcash.Stamp
    • HashDigest<T>
    • HashDigestExtension
    • Nonce
  • Libplanet.Action
    • AccountStateGetter
    • ActionEvaluation<T>
    • ActionTypeAttribute
    • AddressStateMap
    • IAccountStateDelta
    • IAction
    • IActionContext
    • IRandom
    • MissingActionTypeException
    • PolymorphicAction<T>
  • Libplanet.Blockchain
    • BlockChain<T>
  • Libplanet.Blockchain.Policies
    • BlockPolicy<T>
    • BlockPolicyExtension
    • IBlockPolicy<T>
  • Libplanet.Blocks
    • Block<T>
    • InvalidBlockDifficultyException
    • InvalidBlockException
    • InvalidBlockHashException
    • InvalidBlockIndexException
    • InvalidBlockNonceException
    • InvalidBlockPreviousHashException
    • InvalidBlockTimestampException
  • Libplanet.Crypto
    • InvalidCiphertextException
    • PrivateKey
    • PublicKey
    • SymmetricKey
  • Libplanet.Net
    • BlockDownloadState
    • DifferentAppProtocolVersionException
    • DifferentProtocolVersionEventArgs
    • IceServer
    • IceServerException
    • InvalidMessageException
    • NoSwarmContextException
    • Peer
    • PeerNotFoundException
    • PeerSetDelta
    • Swarm
    • SwarmException
  • Libplanet.Serialization
    • BencodexFormatter<T>
    • SerializationInfoExtension
  • Libplanet.Store
    • BaseIndex<TKey, TVal>
    • BaseStore
    • BlockSet<T>
    • FileStore
    • IStore
    • NamespaceNotFoundException
    • TransactionSet<T>
  • Libplanet.Tx
    • InvalidTxException
    • InvalidTxIdException
    • InvalidTxNonceException
    • InvalidTxPublicKeyException
    • InvalidTxSignatureException
    • InvalidTxUpdatedAddressesException
    • Transaction<T>
    • TxId
    • UnexpectedlyTerminatedTxRehearsalException

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, Int64, Int32)

Creates a BlockPolicy<T> with configuring BlockInterval in milliseconds, Libplanet.Blockchain.Policies.BlockPolicy`1.MinimumDifficulty and Libplanet.Blockchain.Policies.BlockPolicy`1.DifficultyBoundDivisor.

Declaration
public BlockPolicy(int blockIntervalMilliseconds = 5000, long minimumDifficulty = 1024L, int difficultyBoundDivisor = 128)
Parameters
Type Name Description
Int32 blockIntervalMilliseconds

Configures BlockInterval in milliseconds. 5000 milliseconds by default.

Int64 minimumDifficulty

Configures Libplanet.Blockchain.Policies.BlockPolicy`1.MinimumDifficulty. 1024 by default.

Int32 difficultyBoundDivisor

Configures Libplanet.Blockchain.Policies.BlockPolicy`1.DifficultyBoundDivisor. 128 by default.

| Improve this Doc View Source

BlockPolicy(TimeSpan, Int64, Int32)

Creates a BlockPolicy<T> with configuring BlockInterval, Libplanet.Blockchain.Policies.BlockPolicy`1.MinimumDifficulty and Libplanet.Blockchain.Policies.BlockPolicy`1.DifficultyBoundDivisor.

Declaration
public BlockPolicy(TimeSpan blockInterval, long minimumDifficulty, int difficultyBoundDivisor)
Parameters
Type Name Description
TimeSpan blockInterval

Configures BlockInterval.

Int64 minimumDifficulty

Configures Libplanet.Blockchain.Policies.BlockPolicy`1.MinimumDifficulty.

Int32 difficultyBoundDivisor

Configures Libplanet.Blockchain.Policies.BlockPolicy`1.DifficultyBoundDivisor.

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(IReadOnlyList<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(IReadOnlyList<Block<T>>)

Declaration
public long GetNextBlockDifficulty(IReadOnlyList<Block<T>> blocks)
Parameters
Type Name Description
IReadOnlyList<Block<T>> blocks
Returns
Type Description
Int64
| Improve this Doc View Source

ValidateNextBlock(IReadOnlyList<Block<T>>, Block<T>)

Declaration
public InvalidBlockException ValidateNextBlock(IReadOnlyList<Block<T>> blocks, Block<T> nextBlock)
Parameters
Type Name Description
IReadOnlyList<Block<T>> blocks
Block<T> nextBlock
Returns
Type Description
InvalidBlockException

Implements

IBlockPolicy<T>

Extension Methods

BlockPolicyExtension.ValidateBlocks<T>(IBlockPolicy<T>, IReadOnlyList<Block<T>>, DateTimeOffset)
  • Improve this Doc
  • View Source
Back to top Copyright © 2019 Planetarium
Generated by DocFX