Show / Hide Table of Contents

Class TotalDifficultyComparer

The default canonical chain comparer (which purpose to be a CanonicalChainComparer).

The chain which has the most TotalDifficulty is considered the greatest, i.e., canonical chain.

Inheritance
Object
TotalDifficultyComparer
Namespace: Libplanet.Blockchain
Assembly: Libplanet.dll
Syntax
public class TotalDifficultyComparer : IComparer<IBlockExcerpt>
Remarks

Although this compares blocks' total difficulty, if two blocks have different protocol version, it always consider the higher version greater.

Constructors

| Improve this Doc View Source

TotalDifficultyComparer()

Creates a TotalDifficultyComparer instance.

Declaration
public TotalDifficultyComparer()

Methods

| Improve this Doc View Source

Compare(IBlockExcerpt, IBlockExcerpt)

Declaration
public int Compare(IBlockExcerpt x, IBlockExcerpt y)
Parameters
Type Name Description
IBlockExcerpt x
IBlockExcerpt y
Returns
Type Description
Int32

See Also

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