Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Fix ergo network hashrate. Fixes #1231
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Weichhold committed Apr 16, 2022
1 parent 0af20c2 commit 14f4b26
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class BitcoinConstants
{
public const int ExtranoncePlaceHolderLength = 8;
public const decimal SatoshisPerBitcoin = 100000000;
public static double Pow2x32 = Math.Pow(2, 32);
public static readonly double Pow2x32 = Math.Pow(2, 32);
public static readonly BigInteger Diff1 = BigInteger.Parse("00ffff0000000000000000000000000000000000000000000000000000", NumberStyles.HexNumber);
public const int CoinbaseMinConfimations = 102;

Expand Down
2 changes: 1 addition & 1 deletion src/Miningcore/Blockchain/Ergo/ErgoConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class ErgoConstants
{
public const uint ShareMultiplier = 256;
public const decimal SmallestUnit = 1000000000;
public static Regex RegexChain = new("ergo-([^-]+)-.+", RegexOptions.Compiled);
public static readonly Regex RegexChain = new("ergo-([^-]+)-.+", RegexOptions.Compiled);

public static byte[] M = Enumerable.Range(0, 1024)
.Select(x => BitConverter.GetBytes((ulong) x).Reverse())
Expand Down
2 changes: 1 addition & 1 deletion src/Miningcore/Blockchain/Ergo/ErgoJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ await GetBlockTemplateAsync() :
BlockchainStats.BlockHeight = job.Height;
BlockchainStats.ConnectedPeers = info.PeersCount;
BlockchainStats.NetworkDifficulty = (double) info.Difficulty;
BlockchainStats.NetworkHashrate = BlockchainStats.NetworkDifficulty / blockTimeAvg;
BlockchainStats.NetworkHashrate = (BlockchainStats.NetworkDifficulty / Math.Pow(2, 32)) / blockTimeAvg;
}

else
Expand Down

0 comments on commit 14f4b26

Please sign in to comment.