Class BlockContentExtensions
Convenient extension methods for IBlockContent<T>.
Namespace: Libplanet.Blocks
Assembly: Libplanet.dll
Syntax
public static class BlockContentExtensions : object
Methods
| Improve this Doc View SourceCopy<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 |
InvalidBlockIndexException | Thrown when the value to set is negative. |
InvalidBlockDifficultyException | Thrown when the value to set is is negative. |
InvalidBlockTotalDifficultyException | Thrown when
the |
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
|