Class BlockLocator
A class that contains the hashes for a series of blocks.
Namespace: Libplanet.Blockchain
Assembly: Libplanet.dll
Syntax
public class BlockLocator : IEnumerable<BlockHash>
Constructors
| Improve this Doc View SourceBlockLocator(Func<Int64, Nullable<BlockHash>>, Func<BlockHash, Int64>, Int32)
Initializes a new instance of BlockLocator with a set of indexer
functions, sampling after sampleAfter
number of blocks.
Declaration
public BlockLocator(Func<long, BlockHash?> indexBlockHash, Func<BlockHash, long> indexByBlockHash, int sampleAfter = 10)
Parameters
Type | Name | Description |
---|---|---|
Func<Int64, Nullable<BlockHash>> | indexBlockHash | A function that converts an index to a BlockHash. |
Func<BlockHash, Int64> | indexByBlockHash | A function that converts a BlockHash to its index. |
Int32 | sampleAfter | The number of consequent blocks to include before sampling. |
BlockLocator(IEnumerable<BlockHash>)
Initializes a new instance of BlockLocator from hashes
.
Declaration
public BlockLocator(IEnumerable<BlockHash> hashes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<BlockHash> | hashes | Enumerable of BlockHashes to convert from. |
Methods
| Improve this Doc View SourceGetEnumerator()
Gets the enumerator.
Declaration
public IEnumerator<BlockHash> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<BlockHash> | The enumerator. |