Show / Hide Table of Contents

Class BlockLocator

A class that contains the hashes for a series of blocks.

Inheritance
Object
BlockLocator
Namespace: Libplanet.Blockchain
Assembly: Libplanet.dll
Syntax
public class BlockLocator : IEnumerable<BlockHash>

Constructors

| Improve this Doc View Source

BlockLocator(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.

| Improve this Doc View Source

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 Source

GetEnumerator()

Gets the enumerator.

Declaration
public IEnumerator<BlockHash> GetEnumerator()
Returns
Type Description
IEnumerator<BlockHash>

The enumerator.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2022 Planetarium