• 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

Interface IBlockPolicy<T>

An interface to determine if consecutive Block<T>s are valid, and to suggest how difficult a Nonce for a Block<T> to be mined.

Namespace: Libplanet.Blockchain.Policies
Assembly: Libplanet.dll
Syntax
public interface IBlockPolicy<T>
    where T : IAction, new()
Type Parameters
Name Description
T

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

Methods

| Improve this Doc View Source

GetNextBlockDifficulty(IReadOnlyList<Block<T>>)

Determines a right Difficulty for a new Block<T> to be mined right after the given blocks.

Declaration
long GetNextBlockDifficulty(IReadOnlyList<Block<T>> blocks)
Parameters
Type Name Description
IReadOnlyList<Block<T>> blocks

Consecutive Block<T>s to be followed by a new Block<T> to be mined.

Returns
Type Description
Int64

A right Difficulty for a new Block<T> to be mined.

| Improve this Doc View Source

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

Checks if nextBlock is invalid, and if that returns the reason.

Note that it returns null when nextBlock is valid.

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

Consecutive Block<T>s to append nextBlock.

Block<T> nextBlock

The next block to append to blocks.

Returns
Type Description
InvalidBlockException

The reason why the given blocks are invalid, or null if blocks are valid.

See Also
ValidateBlocks<T>(IBlockPolicy<T>, IReadOnlyList<Block<T>>, DateTimeOffset)

Extension Methods

BlockPolicyExtension.ValidateBlocks<T>(IBlockPolicy<T>, IReadOnlyList<Block<T>>, DateTimeOffset)

See Also

BlockPolicyExtension
  • Improve this Doc
  • View Source
Back to top Copyright © 2019 Planetarium
Generated by DocFX