• 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 BlockPolicyExtension

This extension class enables some convenient methods (sugar for the most part) to deal with IBlockPolicy<T>.

Inheritance
Object
BlockPolicyExtension
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 static class BlockPolicyExtension

Methods

| Improve this Doc View Source

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

Checks if blocks are invalid, and if that returns the reason.

Note that it returns null when blocks are valid.

Declaration
public static InvalidBlockException ValidateBlocks<T>(this IBlockPolicy<T> policy, IReadOnlyList<Block<T>> blocks, DateTimeOffset currentTime)
    where T : IAction, new()
Parameters
Type Name Description
IBlockPolicy<T> policy

IBlockPolicy<T> to used for validation blocks.

IReadOnlyList<Block<T>> blocks

Consecutive Block<T>s to validate.

DateTimeOffset currentTime

The current time to be used to validate of Timestamps. Usually UtcNow is used.

Returns
Type Description
InvalidBlockException

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

Type Parameters
Name Description
T

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

See Also
IBlockPolicy<T>
ValidateNextBlock(IReadOnlyList<Block<T>>, Block<T>)

See Also

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