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.
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 SourceTotalDifficultyComparer()
Creates a TotalDifficultyComparer instance.
Declaration
public TotalDifficultyComparer()
Methods
| Improve this Doc View SourceCompare(IBlockExcerpt, IBlockExcerpt)
Declaration
public int Compare(IBlockExcerpt x, IBlockExcerpt y)
Parameters
Type | Name | Description |
---|---|---|
IBlockExcerpt | x | |
IBlockExcerpt | y |
Returns
Type | Description |
---|---|
Int32 |