Show / Hide Table of Contents

Class BlockContentExtensions

Convenient extension methods for IBlockContent<T>.

Inheritance
Object
BlockContentExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Blocks
Assembly: Libplanet.dll
Syntax
public static class BlockContentExtensions

Methods

| Improve this Doc View Source

Copy<T>(IBlockContent<T>)

Creates a BlockContent<T> by copying the fields of another block content.

Note that it is a shortcut of BlockContent(IBlockContent<T>) constructor.

Declaration
public static BlockContent<T> Copy<T>(this IBlockContent<T> content)
    where T : IAction, new()
Parameters
Type Name Description
IBlockContent<T> content

This source of the block content to copy. This hasn't be a actual BlockContent<T> instance, but can be any object which implements IBlockContent<T> instance.

Returns
Type Description
BlockContent<T>

The copied block content.

Type Parameters
Name Description
T

A class implementing IAction to include. This type parameter is aligned with Transaction<T>'s type parameter.

Exceptions
Type Condition
InvalidBlockProtocolVersionException

Thrown when the content's to set is ProtocolVersion is less than 0, or greater than CurrentProtocolVersion, the latest known protocol version.

InvalidBlockIndexException

Thrown when the value to set is negative.

InvalidBlockDifficultyException

Thrown when the value to set is is negative.

InvalidBlockTotalDifficultyException

Thrown when the content's TotalDifficulty is less than its Difficulty.

InvalidTxSignatureException

Thrown when any tx signature is invalid or not signed by its signer.

InvalidTxPublicKeyException

Thrown when any tx signer is not derived from its its public key.

InvalidTxNonceException

Thrown when the same tx nonce is used by a signer twice or more, or a tx nonce is used without its previous nonce by a signer. Note that this validates only a block's intrinsic integrity between its transactions, but does not guarantee integrity between blocks. Such validation needs to be conducted by BlockChain<T>.

InvalidTxGenesisHashException

Thrown when transactions to set have inconsistent genesis hashes.

InvalidBlockTxHashException

Thrown when the given block content's TxHash is not consistent with its Transactions.

See Also
BlockContent(IBlockContent<T>)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2021 Planetarium