Class BlockMetadataExtensions
Convenient extension methods for IBlockMetadata.
Namespace: Libplanet.Blocks
Assembly: Libplanet.dll
Syntax
public static class BlockMetadataExtensions : object
Methods
| Improve this Doc View SourceCopy(IBlockMetadata)
Creates a BlockMetadata by copying the fields of another block
metadata.
This is a shortcut of BlockMetadata(IBlockMetadata) constructor.
Declaration
public static BlockMetadata Copy(this IBlockMetadata metadata)
Parameters
| Type | Name | Description |
|---|---|---|
| IBlockMetadata | metadata | This source of the block metadata to copy. This hasn't be a actual BlockMetadata instance, but can be any object which implements IBlockMetadata instance. |
Returns
| Type | Description |
|---|---|
| BlockMetadata | The copied block metadata. |
Exceptions
| Type | Condition |
|---|---|
| InvalidBlockProtocolVersionException | Thrown when
the |
| InvalidBlockIndexException | Thrown when the |
| InvalidBlockDifficultyException | Thrown when
the |
| InvalidBlockTotalDifficultyException | Thrown when
the |
See Also
| Improve this Doc View SourceValidateTimestamp(IBlockMetadata)
Checks if the given blockMetadata's
Timestamp is valid. No-op if valid.
Declaration
public static void ValidateTimestamp(this IBlockMetadata blockMetadata)
Parameters
| Type | Name | Description |
|---|---|---|
| IBlockMetadata | blockMetadata | The block metadata to validate. |
Exceptions
| Type | Condition |
|---|---|
| InvalidBlockTimestampException | Thrown when Timestamp is invalid. For example, if Timestamp is too far in the future compared to the current time. |
ValidateTimestamp(IBlockMetadata, DateTimeOffset)
Checks if the given blockMetadata's
Timestamp is valid. No-op if valid.
Declaration
public static void ValidateTimestamp(this IBlockMetadata blockMetadata, DateTimeOffset currentTime)
Parameters
| Type | Name | Description |
|---|---|---|
| IBlockMetadata | blockMetadata | The block metadata to validate. |
| DateTimeOffset | currentTime | Explicitly specify the current time. |
Exceptions
| Type | Condition |
|---|---|
| InvalidBlockTimestampException | Thrown when
Timestamp is invalid. For example,
if Timestamp is too far in the future
compared to |