diff --git a/Xeno.sln b/Xeno.sln index fc8866a..d89d7c6 100644 --- a/Xeno.sln +++ b/Xeno.sln @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xenopool.Server", "Xenopool EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xenopool.Client", "Xenopool\Client\Xenopool.Client.csproj", "{F995DC5A-D77F-4371-9C9C-0A3C301A6E48}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xenopool.Shared", "Xenopool\Shared\Xenopool.Shared.csproj", "{DD97147E-84C1-44D3-94DE-E6708485B0E2}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xenolib", "Xenolib\Xenolib.csproj", "{5E48710D-46E3-406A-90A1-FD0791CF8504}" EndProject Global @@ -33,10 +31,6 @@ Global {F995DC5A-D77F-4371-9C9C-0A3C301A6E48}.Debug|Any CPU.Build.0 = Debug|Any CPU {F995DC5A-D77F-4371-9C9C-0A3C301A6E48}.Release|Any CPU.ActiveCfg = Release|Any CPU {F995DC5A-D77F-4371-9C9C-0A3C301A6E48}.Release|Any CPU.Build.0 = Release|Any CPU - {DD97147E-84C1-44D3-94DE-E6708485B0E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DD97147E-84C1-44D3-94DE-E6708485B0E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD97147E-84C1-44D3-94DE-E6708485B0E2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD97147E-84C1-44D3-94DE-E6708485B0E2}.Release|Any CPU.Build.0 = Release|Any CPU {5E48710D-46E3-406A-90A1-FD0791CF8504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E48710D-46E3-406A-90A1-FD0791CF8504}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E48710D-46E3-406A-90A1-FD0791CF8504}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Pool.proto b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Service.proto similarity index 96% rename from Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Pool.proto rename to Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Service.proto index 1f47f15..98958f2 100644 --- a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Pool.proto +++ b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Pool/Service.proto @@ -5,7 +5,7 @@ import "google/api/annotations.proto"; package Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool; // Mining Pool Service -service Pool { +service PoolService { // Authenticate miner by providing wallet address and worker id. rpc Login (LoginRequest) returns (LoginResponse) { option (google.api.http) = { @@ -104,8 +104,8 @@ message JobSubmitRequest { int64 second_number = 4; string operator = 5; int64 solution = 6; - string user_agent = 7; - bytes raw_data = 8; + bytes encrypted_share = 7; + bytes encrypted_share_hash = 8; } message JobSubmitResponse { diff --git a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/BlockHeader.cs b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/BlockHeader.cs index 38ef4c6..50bcbc8 100644 --- a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/BlockHeader.cs +++ b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/BlockHeader.cs @@ -6,7 +6,7 @@ namespace Xenolib.Algorithms.Xenophyte.Centralized.Networking.Solo; public sealed partial class BlockHeader { - public int BlockHeight { get; private set; } + public long BlockHeight { get; private set; } public long BlockTimestampCreate { get; private set; } @@ -76,7 +76,7 @@ public bool UpdateBlockHeader(ReadOnlySpan packet) switch (match.Groups["key"].Value) { case "ID": - BlockHeight = int.Parse(match.Groups["value"].Value); + BlockHeight = long.Parse(match.Groups["value"].Value); break; case "TIMESTAMP": diff --git a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/PacketData.cs b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/PacketData.cs index a791671..6ca3bd0 100644 --- a/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/PacketData.cs +++ b/Xenolib/Algorithms/Xenophyte/Centralized/Networking/Solo/PacketData.cs @@ -121,7 +121,7 @@ private async Task TryExecuteReadAsync(NetworkStream networkStream, Memory public void Dispose() { - _packetArrayPoolOwner.Dispose(); GC.SuppressFinalize(this); + _packetArrayPoolOwner.Dispose(); } } \ No newline at end of file diff --git a/Xenolib/Algorithms/Xenophyte/Centralized/Utilities/CpuMinerUtility.cs b/Xenolib/Algorithms/Xenophyte/Centralized/Utilities/CpuMinerUtility.cs index 2e4168b..fa4a6ff 100644 --- a/Xenolib/Algorithms/Xenophyte/Centralized/Utilities/CpuMinerUtility.cs +++ b/Xenolib/Algorithms/Xenophyte/Centralized/Utilities/CpuMinerUtility.cs @@ -1,10 +1,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Xenolib.Algorithms.Xenophyte.Centralized.Utilities; public static partial class CpuMinerUtility { + [UnsupportedOSPlatform("browser")] private static partial class Native { [LibraryImport(Program.XenoNativeLibrary)] @@ -17,23 +19,22 @@ private static partial class Native [return: MarshalAs(UnmanagedType.Bool)] public static partial bool XenophyteCentralizedAlgorithm_MakeEncryptedShare(ReadOnlySpan input, int inputLength, Span encryptedShare, Span hashEncryptedShare, ReadOnlySpan xorKey, int xorKeyLength, int aesKeySize, ReadOnlySpan aesKey, ReadOnlySpan aesIv, int aesRound); } - - public const string JobTypeEasy = "Easy Block"; - public const string JobTypeSemiRandom = "Semi Random"; - public const string JobTypeRandom = "Random"; + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GenerateEasyBlockNumbers(long minValue, long maxValue, Span output) { return Native.XenophyteCentralizedAlgorithm_GenerateEasyBlockNumbers(minValue, maxValue, output); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GenerateNonEasyBlockNumbers(long minValue, long maxValue, Span output) { return Native.XenophyteCentralizedAlgorithm_GenerateNonEasyBlockNumbers(minValue, maxValue, output); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MakeEncryptedShare(ReadOnlySpan input, Span encryptedShare, Span hashEncryptedShare, ReadOnlySpan xorKey, ReadOnlySpan aesKey, ReadOnlySpan aesIv, int aesRound) { diff --git a/Xenolib/Utilities/Base64Utility.cs b/Xenolib/Utilities/Base64Utility.cs index 628ddfd..99056da 100644 --- a/Xenolib/Utilities/Base64Utility.cs +++ b/Xenolib/Utilities/Base64Utility.cs @@ -1,10 +1,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Xenolib.Utilities; public static partial class Base64Utility { + [UnsupportedOSPlatform("browser")] private static partial class Native { [LibraryImport(Program.XenoNativeLibrary)] @@ -20,24 +22,28 @@ private static partial class Native public static partial int Base64Utility_Decode(ReadOnlySpan input, int inputLength, Span output); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int EncodeLength(ReadOnlySpan value) { return Native.Base64Utility_EncodeLength(value.Length); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int DecodeLength(ReadOnlySpan value) { return Native.Base64Utility_DecodeLength(value, value.Length); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Encode(ReadOnlySpan input, Span output) { return Native.Base64Utility_Encode(input, input.Length, output); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Decode(ReadOnlySpan input, Span output) { diff --git a/Xenolib/Utilities/BufferUtility.cs b/Xenolib/Utilities/BufferUtility.cs index 0bd4632..1515cc8 100644 --- a/Xenolib/Utilities/BufferUtility.cs +++ b/Xenolib/Utilities/BufferUtility.cs @@ -1,10 +1,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Xenolib.Utilities; public static partial class BufferUtility { + [UnsupportedOSPlatform("browser")] private static partial class Native { [LibraryImport(Program.XenoNativeLibrary)] @@ -17,18 +19,21 @@ private static partial class Native public static partial void BufferUtility_MemoryCopy_Long(Span destination, ReadOnlySpan source, int length); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void MemoryCopy(ReadOnlySpan source, Span destination, int length) { Native.BufferUtility_MemoryCopy_Byte(destination, source, length); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void MemoryCopy(ReadOnlySpan source, Span destination, int length) { Native.BufferUtility_MemoryCopy_Int(destination, source, length); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void MemoryCopy(ReadOnlySpan source, Span destination, int length) { diff --git a/Xenolib/Utilities/CpuInformationUtility.cs b/Xenolib/Utilities/CpuInformationUtility.cs index c76fdac..10555d3 100644 --- a/Xenolib/Utilities/CpuInformationUtility.cs +++ b/Xenolib/Utilities/CpuInformationUtility.cs @@ -1,8 +1,10 @@ using System.Runtime.InteropServices; using System.Runtime.Intrinsics.X86; +using System.Runtime.Versioning; namespace Xenolib.Utilities; +[UnsupportedOSPlatform("browser")] public static partial class CpuInformationUtility { private static partial class Native diff --git a/Xenolib/Utilities/MessageDigestUtility.cs b/Xenolib/Utilities/MessageDigestUtility.cs index d1b1025..42a39a1 100644 --- a/Xenolib/Utilities/MessageDigestUtility.cs +++ b/Xenolib/Utilities/MessageDigestUtility.cs @@ -1,10 +1,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Xenolib.Utilities; public static partial class MessageDigestUtility { + [UnsupportedOSPlatform("browser")] private static partial class Native { [LibraryImport(Program.XenoNativeLibrary)] @@ -17,18 +19,21 @@ private static partial class Native public static partial int MessageDigestUtility_ComputeSha3_512Hash(ReadOnlySpan source, int length, Span destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ComputeSha2_256Hash(ReadOnlySpan source, Span destination) { return Native.MessageDigestUtility_ComputeSha2_256Hash(source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ComputeSha2_512Hash(ReadOnlySpan source, Span destination) { return Native.MessageDigestUtility_ComputeSha2_512Hash(source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ComputeSha3_512Hash(ReadOnlySpan source, Span destination) { diff --git a/Xenolib/Utilities/SymmetricAlgorithmUtility.cs b/Xenolib/Utilities/SymmetricAlgorithmUtility.cs index 8b70529..583e90b 100644 --- a/Xenolib/Utilities/SymmetricAlgorithmUtility.cs +++ b/Xenolib/Utilities/SymmetricAlgorithmUtility.cs @@ -1,10 +1,12 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Xenolib.Utilities; public static partial class SymmetricAlgorithmUtility { + [UnsupportedOSPlatform("browser")] private static partial class Native { [LibraryImport(Program.XenoNativeLibrary)] @@ -23,30 +25,35 @@ private static partial class Native public static partial int SymmetricAlgorithmUtility_Decrypt_AES_256_CFB_8(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, int sourceLength, Span destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Encrypt_AES_128_CBC(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, Span destination) { return Native.SymmetricAlgorithmUtility_Encrypt_AES_128_CBC(key, iv, source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Encrypt_AES_192_CBC(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, Span destination) { return Native.SymmetricAlgorithmUtility_Encrypt_AES_192_CBC(key, iv, source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Encrypt_AES_256_CBC(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, Span destination) { return Native.SymmetricAlgorithmUtility_Encrypt_AES_256_CBC(key, iv, source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Encrypt_AES_256_CFB_8(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, Span destination) { return Native.SymmetricAlgorithmUtility_Encrypt_AES_256_CFB_8(key, iv, source, source.Length, destination); } + [UnsupportedOSPlatform("browser")] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Decrypt_AES_256_CFB_8(ReadOnlySpan key, ReadOnlySpan iv, ReadOnlySpan source, Span destination) { diff --git a/Xenolib/Xenolib.csproj b/Xenolib/Xenolib.csproj index 875835e..5837853 100644 --- a/Xenolib/Xenolib.csproj +++ b/Xenolib/Xenolib.csproj @@ -27,6 +27,10 @@ none + + + + @@ -34,7 +38,7 @@ - + diff --git a/Xenopool/Client/Xenopool.Client.csproj b/Xenopool/Client/Xenopool.Client.csproj index 43154e5..78c3973 100644 --- a/Xenopool/Client/Xenopool.Client.csproj +++ b/Xenopool/Client/Xenopool.Client.csproj @@ -7,13 +7,9 @@ - - - - - - - + + + diff --git a/Xenopool/Server/ConsoleService.cs b/Xenopool/Server/ConsoleService.cs index ec0787e..0adce34 100644 --- a/Xenopool/Server/ConsoleService.cs +++ b/Xenopool/Server/ConsoleService.cs @@ -30,8 +30,10 @@ protected override async Task ExecuteAsync(CancellationToken cancellationToken) Logger.PrintCpuCont(_logger, string.Empty, CpuInformationUtility.ProcessorL2Cache / 1024.0 / 1024.0, CpuInformationUtility.ProcessorL3Cache / 1024.0 / 1024.0, CpuInformationUtility.ProcessorCoreCount, CpuInformationUtility.ProcessorThreadCount); Logger.PrintEmpty(_logger); - await using var sqliteDatabaseContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); - await sqliteDatabaseContext.Database.MigrateAsync(cancellationToken); + await using (var sqliteDatabaseContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken)) + { + await sqliteDatabaseContext.Database.MigrateAsync(cancellationToken); + } if (!await _rpcWalletNetwork.CheckIfWalletAddressExistAsync(cancellationToken)) { diff --git a/Xenopool/Server/Database/Repository/PoolAccountRepository.cs b/Xenopool/Server/Database/Repository/PoolAccountRepository.cs index 25b63bb..ab996d6 100644 --- a/Xenopool/Server/Database/Repository/PoolAccountRepository.cs +++ b/Xenopool/Server/Database/Repository/PoolAccountRepository.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Xenopool.Server.Database.Tables; +using Xenopool.Server.Database.Tables; namespace Xenopool.Server.Database.Repository; @@ -23,11 +22,6 @@ public PoolAccount CreateAccount(string walletAddress) { return _context.PoolAccounts.SingleOrDefault(account => account.WalletAddress == walletAddress); } - - public Task GetAccountAsync(string walletAddress, CancellationToken cancellationToken) - { - return _context.PoolAccounts.SingleOrDefaultAsync(account => account.WalletAddress == walletAddress, cancellationToken); - } public Task SaveChangesAsync(CancellationToken cancellationToken) { diff --git a/Xenopool/Server/Database/SqliteDatabaseContext.cs b/Xenopool/Server/Database/SqliteDatabaseContext.cs index 9c06602..d97a6da 100644 --- a/Xenopool/Server/Database/SqliteDatabaseContext.cs +++ b/Xenopool/Server/Database/SqliteDatabaseContext.cs @@ -1,6 +1,7 @@ #pragma warning disable IL2026 using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Xenopool.Server.Database.Tables; namespace Xenopool.Server.Database; diff --git a/Xenopool/Server/ILLink.Descriptors.xml b/Xenopool/Server/ILLink.Descriptors.xml index a972e3a..1015104 100644 --- a/Xenopool/Server/ILLink.Descriptors.xml +++ b/Xenopool/Server/ILLink.Descriptors.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/Xenopool/Server/Logger.cs b/Xenopool/Server/Logger.cs index 8c5e382..1a3c99a 100644 --- a/Xenopool/Server/Logger.cs +++ b/Xenopool/Server/Logger.cs @@ -26,7 +26,7 @@ public static partial class Logger public static partial void PrintConnected(ILogger logger, string mode, string host); [LoggerMessage(EventId = 12, Level = LogLevel.Information, Message = $"{MagentaForegroundColor}{{job}}{Reset} from {WhiteForegroundColor}{{host}}{Reset} diff {WhiteForegroundColor}{{difficulty}}{Reset} algo {WhiteForegroundColor}{{algorithm}}{Reset} height {WhiteForegroundColor}{{height}}{Reset}")] - public static partial void PrintJob(ILogger logger, string job, string host, long difficulty, string algorithm, int height); + public static partial void PrintJob(ILogger logger, string job, string host, long difficulty, string algorithm, long height); [LoggerMessage(EventId = 15, Level = LogLevel.Information, Message = $"{GreenForegroundColor}Job Type: {{jobType}} | Block found: {{firstNumber}} {{operatorSymbol}} {{secondNumber}} = {{result}}{Reset}")] public static partial void PrintBlockFound(ILogger logger, string jobType, long firstNumber, char operatorSymbol, long secondNumber, long result); diff --git a/Xenopool/Server/Pool/PoolClient.cs b/Xenopool/Server/Pool/PoolClient.cs index 6390704..745555d 100644 --- a/Xenopool/Server/Pool/PoolClient.cs +++ b/Xenopool/Server/Pool/PoolClient.cs @@ -1,4 +1,5 @@ using Xenopool.Server.Database.Tables; +using Xenopool.Server.SoloMining; namespace Xenopool.Server.Pool; @@ -9,6 +10,7 @@ public sealed class PoolClient private DateTime _lastRequestTime = DateTime.Now; + private PoolShare[] _poolShares; private ulong _sharePoints = 0; public PoolClient(PoolAccount poolAccount, string workerId) @@ -26,4 +28,16 @@ public void Ping() { _lastRequestTime = DateTime.Now; } + + public PoolShare[] GeneratePoolShare(SoloMiningNetwork network, int solutions) + { + _poolShares = new PoolShare[solutions]; + + for (var i = 0; i < solutions; i++) + { + _poolShares[i] = network.GeneratePoolShare(); + } + + return _poolShares; + } } \ No newline at end of file diff --git a/Xenopool/Server/Pool/PoolClientManager.cs b/Xenopool/Server/Pool/PoolClientManager.cs index 2f0caca..0af104a 100644 --- a/Xenopool/Server/Pool/PoolClientManager.cs +++ b/Xenopool/Server/Pool/PoolClientManager.cs @@ -1,7 +1,7 @@ -using Grpc.Core; +using System.Collections.Concurrent; +using System.Diagnostics.CodeAnalysis; using Microsoft.EntityFrameworkCore; using Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool; -using Xenolib.Utilities.Buffer; using Xenopool.Server.Database; using Xenopool.Server.Database.Repository; @@ -11,9 +11,8 @@ public sealed class PoolClientManager : IDisposable { private readonly PoolAccountRepository _poolAccountRepository; private readonly Timer _poolClientValidityCheck; - - private readonly SemaphoreSlim _semaphoreSlim = new(1, 1); - private readonly Dictionary _poolClients = new(); + + private readonly ConcurrentDictionary _poolClients = new(); public PoolClientManager(IDbContextFactory contextFactory) { @@ -21,72 +20,38 @@ public PoolClientManager(IDbContextFactory contextFactory _poolClientValidityCheck = new Timer(CheckClientValidity, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); } - public async Task AddClientAsync(LoginRequest request, ServerCallContext context) + public LoginResponse AddClient(LoginRequest request) { - try + var account = _poolAccountRepository.GetAccount(request.WalletAddress) ?? _poolAccountRepository.CreateAccount(request.WalletAddress); + + if (account.IsBanned) { - await _semaphoreSlim.WaitAsync(context.CancellationToken); + return new LoginResponse { Status = false, Reason = account.BanReason ?? string.Empty }; + } - var account = await _poolAccountRepository.GetAccountAsync(request.WalletAddress, context.CancellationToken) ?? _poolAccountRepository.CreateAccount(request.WalletAddress); - - if (account.IsBanned) - { - return new LoginResponse { Status = false, Reason = account.BanReason ?? string.Empty }; - } + string guid; - string guid; - - do - { - guid = Guid.NewGuid().ToString(); - } while (!_poolClients.TryAdd(guid, new PoolClient(account, request.WorkerId))); - - return new LoginResponse { Status = true, Token = guid }; - } - finally + do { - if (_semaphoreSlim.CurrentCount == 0) _semaphoreSlim.Release(); - } - } + guid = Guid.NewGuid().ToString(); + } while (!_poolClients.TryAdd(guid, new PoolClient(account, request.WorkerId))); - public async Task GetClientAsync(string token, CancellationToken cancellationToken = default) + return new LoginResponse { Status = true, Token = guid }; + } + + public bool TryGetClient(string token, [MaybeNullWhen(false)] out PoolClient poolClient) { - try - { - await _semaphoreSlim.WaitAsync(cancellationToken); - return _poolClients.TryGetValue(token, out var poolClient) ? poolClient : null; - } - finally - { - if (_semaphoreSlim.CurrentCount == 0) _semaphoreSlim.Release(); - } + return _poolClients.TryGetValue(token, out poolClient); } private void CheckClientValidity(object? _) { - try + foreach (var poolClient in _poolClients) { - _semaphoreSlim.Wait(); - - using var expiredPoolClients = ArrayPoolOwner.Rent(_poolClients.Count); - var expiredPoolClientCount = 0; - - foreach (var poolClient in _poolClients) + if (poolClient.Value.IsExpire()) { - if (poolClient.Value.IsExpire()) - { - expiredPoolClients.Span[expiredPoolClientCount++] = poolClient.Key; - } + _poolClients.TryRemove(poolClient); } - - for (var i = 0; i < expiredPoolClientCount; i++) - { - _poolClients.Remove(expiredPoolClients.Span[i]); - } - } - finally - { - if (_semaphoreSlim.CurrentCount == 0) _semaphoreSlim.Release(); } } @@ -94,6 +59,5 @@ public void Dispose() { _poolAccountRepository.Dispose(); _poolClientValidityCheck.Dispose(); - _semaphoreSlim.Dispose(); } } \ No newline at end of file diff --git a/Xenopool/Server/Pool/PoolService.cs b/Xenopool/Server/Pool/PoolService.cs index ab2f0ca..69469f7 100644 --- a/Xenopool/Server/Pool/PoolService.cs +++ b/Xenopool/Server/Pool/PoolService.cs @@ -4,7 +4,7 @@ namespace Xenopool.Server.Pool; -public sealed class PoolService : Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool.Pool.PoolBase +public sealed class PoolService : Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool.PoolService.PoolServiceBase { private readonly SoloMiningNetwork _soloMiningNetwork; private readonly PoolClientManager _poolClientManager; @@ -15,41 +15,45 @@ public PoolService(SoloMiningNetwork soloMiningNetwork, PoolClientManager poolCl _poolClientManager = poolClientManager; } - public override async Task Login(LoginRequest request, ServerCallContext context) + public override Task Login(LoginRequest request, ServerCallContext context) { - return await _poolClientManager.AddClientAsync(request, context); + return Task.FromResult(_poolClientManager.AddClient(request)); } - public override async Task GetBlockHeader(BlockHeaderRequest request, ServerCallContext context) + public override Task GetBlockHeader(BlockHeaderRequest request, ServerCallContext context) { - var poolClient = await _poolClientManager.GetClientAsync(request.Token, context.CancellationToken); - - if (poolClient == null) + if (!_poolClientManager.TryGetClient(request.Token, out var poolClient)) { - return new BlockHeaderResponse { Status = false, Reason = "User not authorized." }; + return Task.FromResult(new BlockHeaderResponse { Status = false, Reason = "User not authorized." }); } poolClient.Ping(); - - return await Task.FromResult(_soloMiningNetwork.BlockHeaderResponse); + + return Task.FromResult(_soloMiningNetwork.BlockHeaderResponse); } - public override async Task RequestNewJob(JobHeaderRequest request, ServerCallContext context) + public override Task RequestNewJob(JobHeaderRequest request, ServerCallContext context) { - var poolClient = await _poolClientManager.GetClientAsync(request.Token, context.CancellationToken); - - if (poolClient == null) + if (!_poolClientManager.TryGetClient(request.Token, out var poolClient)) { - return new JobHeaderResponse { Status = false, Reason = "User not authorized." }; + return Task.FromResult(new JobHeaderResponse { Status = false, Reason = "User not authorized." }); } - + poolClient.Ping(); - - return await base.RequestNewJob(request, context); + + var response = new JobHeaderResponse { Status = true }; + response.JobIndications.AddRange(poolClient.GeneratePoolShare(_soloMiningNetwork, request.JobSolutions).Select(share => share.EncryptedShareHash)); + + return Task.FromResult(response); } public override Task SubmitJob(JobSubmitRequest request, ServerCallContext context) { + if (!_poolClientManager.TryGetClient(request.Token, out var poolClient)) + { + return Task.FromResult(new JobSubmitResponse { Status = false, Reason = "User not authorized." }); + } + return base.SubmitJob(request, context); } } \ No newline at end of file diff --git a/Xenopool/Server/Pool/PoolShare.cs b/Xenopool/Server/Pool/PoolShare.cs new file mode 100644 index 0000000..84c4e51 --- /dev/null +++ b/Xenopool/Server/Pool/PoolShare.cs @@ -0,0 +1,18 @@ +namespace Xenopool.Server.Pool; + +public struct PoolShare +{ + public long BlockHeight { get; init; } + + public long FirstNumber { get; init; } + + public long SecondNumber { get; init; } + + public char Operator { get; init; } + + public long Solution { get; init; } + + public string EncryptedShare { get; init; } + + public string EncryptedShareHash { get; init; } +} \ No newline at end of file diff --git a/Xenopool/Server/Program.cs b/Xenopool/Server/Program.cs index 05babd2..fbcdb33 100644 --- a/Xenopool/Server/Program.cs +++ b/Xenopool/Server/Program.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.EntityFrameworkCore; -using Microsoft.OpenApi.Models; using TheDialgaTeam.Core.Logging.Microsoft; using Xenopool.Server.Database; using Xenopool.Server.Options; diff --git a/Xenopool/Server/SoloMining/SoloMiningNetwork.cs b/Xenopool/Server/SoloMining/SoloMiningNetwork.cs index a323668..d141086 100644 --- a/Xenopool/Server/SoloMining/SoloMiningNetwork.cs +++ b/Xenopool/Server/SoloMining/SoloMiningNetwork.cs @@ -7,7 +7,8 @@ using Xenolib.Algorithms.Xenophyte.Centralized.Utilities; using Xenolib.Utilities; using Xenopool.Server.Options; -using BlockHeader = Xenolib.Algorithms.Xenophyte.Centralized.Networking.Solo.BlockHeader; +using Xenopool.Server.Pool; +using BlockHeader = Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool.BlockHeader; namespace Xenopool.Server.SoloMining; @@ -30,7 +31,12 @@ public sealed class SoloMiningNetwork : IDisposable private readonly long[] _easyBlockValues = new long[256]; private int _easyBlockValuesLength = 256; - public SoloMiningNetwork(IOptions options, ILogger logger, IHostApplicationLifetime hostApplicationLifetime) + private readonly char[] _operators = { '+', '-', '*', '/', '%' }; + private readonly char[] _operators2 = { '+', '*', '%' }; + + private readonly object _lock = new(); + + public SoloMiningNetwork(IOptions options, ILogger logger) { _options = options; _logger = logger; @@ -43,6 +49,39 @@ public SoloMiningNetwork(IOptions options, ILogger stringToEncrypt = stackalloc char[19 + 1 + 1 + 1 + 19 + 19 + 1]; + + firstNumber.TryFormat(stringToEncrypt, out var firstNumberWritten); + + stringToEncrypt.GetRef(firstNumberWritten) = ' '; + stringToEncrypt.GetRef(firstNumberWritten + 1) = op; + stringToEncrypt.GetRef(firstNumberWritten + 2) = ' '; + + secondNumber.TryFormat(stringToEncrypt[(firstNumberWritten + 3)..], out var secondNumberWritten); + blockHeader.BlockTimestampCreate.TryFormat(stringToEncrypt[(firstNumberWritten + 3 + secondNumberWritten)..], out var finalWritten); + + Span bytesToEncrypt = stackalloc byte[firstNumberWritten + 3 + secondNumberWritten + finalWritten]; + Encoding.UTF8.GetBytes(stringToEncrypt[..(firstNumberWritten + 3 + secondNumberWritten + finalWritten)], bytesToEncrypt); + + Span encryptedShareBytes = stackalloc byte[64 * 2]; + Span hashEncryptedShareBytes = stackalloc byte[64 * 2]; + + if (!CpuMinerUtility.MakeEncryptedShare(bytesToEncrypt, encryptedShareBytes, hashEncryptedShareBytes, blockHeader.XorKey.Span, blockHeader.AesKey.Span, blockHeader.AesIv.Span, blockHeader.AesRound)) + { + encryptedShare = string.Empty; + encryptedShareHash = string.Empty; + return false; + } + + encryptedShare = Encoding.UTF8.GetString(encryptedShareBytes); + encryptedShareHash = Encoding.UTF8.GetString(hashEncryptedShareBytes); + + return blockHeader.BlockIndication == encryptedShareHash; + } + public async Task StartAsync(CancellationToken cancellationToken = default) { _network.Disconnected += NetworkOnDisconnected; @@ -52,6 +91,61 @@ public async Task StartAsync(CancellationToken cancellationToken = default) await _network.ConnectAsync(_networkConnection, cancellationToken); } + public PoolShare GeneratePoolShare() + { + var blockHeader = BlockHeaderResponse.Header; + long firstNumber, secondNumber; + char @operator; + long solution; + + if (RandomNumberGeneratorUtility.GetRandomBetween(1, 100) <= 50) + { + firstNumber = EasyBlockValues[RandomNumberGeneratorUtility.GetRandomBetween(0, 255)]; + + do + { + secondNumber = RandomNumberGeneratorUtility.GetBiasRandomBetween(blockHeader.BlockMinRange, blockHeader.BlockMaxRange); + } while (EasyBlockValues.Contains(secondNumber)); + } + else + { + secondNumber = EasyBlockValues[RandomNumberGeneratorUtility.GetRandomBetween(0, 255)]; + + do + { + firstNumber = RandomNumberGeneratorUtility.GetBiasRandomBetween(blockHeader.BlockMinRange, blockHeader.BlockMaxRange); + } while (EasyBlockValues.Contains(secondNumber)); + } + + do + { + @operator = firstNumber > secondNumber ? _operators[RandomNumberGeneratorUtility.GetRandomBetween(0, _operators.Length - 1)] : _operators2[RandomNumberGeneratorUtility.GetRandomBetween(0, _operators2.Length - 1)]; + + solution = @operator switch + { + '+' => firstNumber + secondNumber, + '-' => firstNumber - secondNumber, + '*' => firstNumber * secondNumber, + '/' => firstNumber % secondNumber == 0 ? firstNumber / secondNumber : 0, + '%' => firstNumber % secondNumber, + var _ => 0 + }; + } while (solution >= blockHeader.BlockMinRange && solution <= blockHeader.BlockMaxRange); + + GenerateHash(firstNumber, secondNumber, @operator, blockHeader, out var encryptedShare, out var encryptedShareHash); + + return new PoolShare + { + BlockHeight = blockHeader.BlockHeight, + FirstNumber = firstNumber, + SecondNumber = secondNumber, + Operator = @operator, + Solution = solution, + EncryptedShare = encryptedShare, + EncryptedShareHash = encryptedShareHash + }; + } + private async Task StopAsync(CancellationToken cancellationToken = default) { _network.Disconnected -= NetworkOnDisconnected; @@ -72,40 +166,40 @@ private void NetworkOnReady() Logger.PrintConnected(_logger, "SOLO", _networkConnection.Uri.Host); } - private void NetworkOnHasNewBlock(BlockHeader blockHeader) + private void NetworkOnHasNewBlock(Xenolib.Algorithms.Xenophyte.Centralized.Networking.Solo.BlockHeader blockHeader) { Logger.PrintJob(_logger, "new job", _networkConnection.Uri.Host, blockHeader.BlockDifficulty, blockHeader.BlockMethod, blockHeader.BlockHeight); - - BlockHeaderResponse = new BlockHeaderResponse + + lock (_lock) { - Status = true, - Header = new Xenolib.Algorithms.Xenophyte.Centralized.Networking.Pool.BlockHeader + BlockHeaderResponse = new BlockHeaderResponse { - BlockHeight = blockHeader.BlockHeight, - BlockTimestampCreate = blockHeader.BlockTimestampCreate, - BlockMethod = blockHeader.BlockMethod, - BlockIndication = blockHeader.BlockIndication, - BlockDifficulty = blockHeader.BlockDifficulty, - BlockMinRange = blockHeader.BlockMinRange, - BlockMaxRange = blockHeader.BlockMaxRange, - XorKey = ByteString.CopyFrom(blockHeader.XorKey), - AesKey = ByteString.CopyFrom(blockHeader.AesKey), - AesIv = ByteString.CopyFrom(blockHeader.AesIv), - AesRound = blockHeader.AesRound - } - }; - - _easyBlockValuesLength = CpuMinerUtility.GenerateEasyBlockNumbers(blockHeader.BlockMinRange, blockHeader.BlockMaxRange, _easyBlockValues); - + Status = true, + Header = new BlockHeader + { + BlockHeight = blockHeader.BlockHeight, + BlockTimestampCreate = blockHeader.BlockTimestampCreate, + BlockMethod = blockHeader.BlockMethod, + BlockIndication = blockHeader.BlockIndication, + BlockDifficulty = blockHeader.BlockDifficulty, + BlockMinRange = blockHeader.BlockMinRange, + BlockMaxRange = blockHeader.BlockMaxRange, + XorKey = ByteString.CopyFrom(blockHeader.XorKey), + AesKey = ByteString.CopyFrom(blockHeader.AesKey), + AesIv = ByteString.CopyFrom(blockHeader.AesIv), + AesRound = blockHeader.AesRound + } + }; + + _easyBlockValuesLength = CpuMinerUtility.GenerateEasyBlockNumbers(blockHeader.BlockMinRange, blockHeader.BlockMaxRange, _easyBlockValues); + } + var easyBlockValues = EasyBlockValues; - var (startIndex, size) = CpuMinerUtility.GetJobChunk(_easyBlockValuesLength, CpuInformationUtility.ProcessorCoreCount, 0); - if (size == 0) return; - - Span chunkData = stackalloc long[size]; - BufferUtility.MemoryCopy(easyBlockValues.Slice(startIndex, size), chunkData, size); + Span chunkData = stackalloc long[_easyBlockValuesLength]; + BufferUtility.MemoryCopy(easyBlockValues, chunkData, _easyBlockValuesLength); - for (var i = size - 1; i >= 0; i--) + for (var i = _easyBlockValuesLength - 1; i >= 0; i--) { var choseRandom = RandomNumberGeneratorUtility.GetRandomBetween(0, i); @@ -122,7 +216,7 @@ private void NetworkOnHasNewBlock(BlockHeader blockHeader) } } - private void DoMathCalculations(long firstNumber, long secondNumber, string jobType, BlockHeader blockHeader) + private void DoMathCalculations(long firstNumber, long secondNumber, string jobType, Xenolib.Algorithms.Xenophyte.Centralized.Networking.Solo.BlockHeader blockHeader) { if (firstNumber > secondNumber) { @@ -177,7 +271,7 @@ private void DoMathCalculations(long firstNumber, long secondNumber, string jobT } [SkipLocalsInit] - private void ValidateAndSubmitShare(long firstNumber, long secondNumber, long solution, char op, string jobType, BlockHeader blockHeader) + private void ValidateAndSubmitShare(long firstNumber, long secondNumber, long solution, char op, string jobType, Xenolib.Algorithms.Xenophyte.Centralized.Networking.Solo.BlockHeader blockHeader) { Span stringToEncrypt = stackalloc char[19 + 1 + 1 + 1 + 19 + 19 + 1]; @@ -206,6 +300,7 @@ private void ValidateAndSubmitShare(long firstNumber, long secondNumber, long so if (!hashEncryptedShareString.SequenceEqual(blockHeader.BlockIndication)) return; + /* _network.SendPacketToNetwork(new PacketData($"{NetworkConstants.ReceiveJob}|{Encoding.UTF8.GetString(encryptedShare)}|{solution}|{firstNumber} {op} {secondNumber}|{hashEncryptedShareString}|{blockHeader.BlockHeight}|{_options.Value.SoloMining.UserAgent}", true, (packet, time) => { Span temp = stackalloc char[Encoding.UTF8.GetCharCount(packet)]; @@ -231,6 +326,7 @@ private void ValidateAndSubmitShare(long firstNumber, long secondNumber, long so //FoundBlock?.Invoke(cpuMinerJob.BlockHeight, jobType, false, InvalidShare, time.TotalMilliseconds); } })); + */ Logger.PrintBlockFound(_logger, jobType, firstNumber, op, secondNumber, solution); } diff --git a/Xenopool/Server/Xenopool.Server.csproj b/Xenopool/Server/Xenopool.Server.csproj index a8ac403..31e0bd6 100644 --- a/Xenopool/Server/Xenopool.Server.csproj +++ b/Xenopool/Server/Xenopool.Server.csproj @@ -46,7 +46,6 @@ - diff --git a/Xenopool/Shared/Xenopool.Shared.csproj b/Xenopool/Shared/Xenopool.Shared.csproj deleted file mode 100644 index a698d1c..0000000 --- a/Xenopool/Shared/Xenopool.Shared.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net7.0 - enable - enable - - - - - - diff --git a/Xenorig/Algorithms/Xenophyte/Centralized/Pool/XenophyteCentralizedPoolAlgorithm.cs b/Xenorig/Algorithms/Xenophyte/Centralized/Pool/XenophyteCentralizedPoolAlgorithm.cs new file mode 100644 index 0000000..7b84aa5 --- /dev/null +++ b/Xenorig/Algorithms/Xenophyte/Centralized/Pool/XenophyteCentralizedPoolAlgorithm.cs @@ -0,0 +1,29 @@ +namespace Xenorig.Algorithms.Xenophyte.Centralized.Pool; + +public class XenophyteCentralizedPoolAlgorithm : IAlgorithm +{ + public Task StartAsync(CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public Task StopAsync(CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public void PrintHashrate() + { + throw new NotImplementedException(); + } + + public void PrintStats() + { + throw new NotImplementedException(); + } + + public void PrintCurrentJob() + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMiner.cs b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMiner.cs index d081929..e21ae5f 100644 --- a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMiner.cs +++ b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMiner.cs @@ -10,7 +10,7 @@ namespace Xenorig.Algorithms.Xenophyte.Centralized.Solo.Miner; -public delegate void BlockSubmitResultHandler(int height, string jobType, bool isGoodBlock, string reason, double roundTripTime); +public delegate void BlockSubmitResultHandler(long height, string jobType, bool isGoodBlock, string reason, double roundTripTime); public sealed partial class CpuMiner { @@ -46,7 +46,7 @@ public static partial class Linux private const string OrphanShare = "Orphan Share"; private readonly ILogger _logger; - private readonly Pool _pool; + private readonly Options.Pool _pool; private readonly XenorigOptions _options; private readonly Network _network; @@ -64,7 +64,7 @@ public static partial class Linux private readonly long[] _totalHashCalculatedIn60Seconds; private readonly long[] _totalHashCalculatedIn15Minutes; - public CpuMiner(XenorigOptions options, ILogger logger, Pool pool, Network network) + public CpuMiner(XenorigOptions options, ILogger logger, Options.Pool pool, Network network) { _logger = logger; _options = options; diff --git a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMinerJob.cs b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMinerJob.cs index f71d067..87f40ad 100644 --- a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMinerJob.cs +++ b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/Miner/CpuMinerJob.cs @@ -5,7 +5,7 @@ namespace Xenorig.Algorithms.Xenophyte.Centralized.Solo.Miner; public sealed class CpuMinerJob { - public int BlockHeight { get; private set; } + public long BlockHeight { get; private set; } public long BlockTimestampCreate { get; private set; } diff --git a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/XenophyteCentralizedSoloAlgorithm.cs b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/XenophyteCentralizedSoloAlgorithm.cs index 956af6e..2237269 100644 --- a/Xenorig/Algorithms/Xenophyte/Centralized/Solo/XenophyteCentralizedSoloAlgorithm.cs +++ b/Xenorig/Algorithms/Xenophyte/Centralized/Solo/XenophyteCentralizedSoloAlgorithm.cs @@ -6,11 +6,11 @@ namespace Xenorig.Algorithms.Xenophyte.Centralized.Solo; -internal class XenophyteCentralizedSoloAlgorithm : IAlgorithm +public class XenophyteCentralizedSoloAlgorithm : IAlgorithm { private readonly ILogger _logger; private readonly XenorigOptions _options; - private readonly Pool _pool; + private readonly Options.Pool _pool; private readonly Network _network; private readonly NetworkConnection _networkConnection; @@ -30,13 +30,13 @@ internal class XenophyteCentralizedSoloAlgorithm : IAlgorithm private int _totalBadSemiRandomBlocksSubmitted; private int _totalBadRandomBlocksSubmitted; - private int _lastFoundHeight; + private long _lastFoundHeight; private readonly object _lastFoundHeightLock = new(); private int TotalGoodBlocksSubmitted => _totalGoodEasyBlocksSubmitted + _totalGoodSemiRandomBlocksSubmitted + _totalGoodRandomBlocksSubmitted; private int TotalBadBlocksSubmitted => _totalBadEasyBlocksSubmitted + _totalBadSemiRandomBlocksSubmitted + _totalBadRandomBlocksSubmitted; - public XenophyteCentralizedSoloAlgorithm(ILogger logger, XenorigOptions options, Pool pool) + public XenophyteCentralizedSoloAlgorithm(ILogger logger, XenorigOptions options, Options.Pool pool) { _logger = logger; _options = options; @@ -107,7 +107,7 @@ private void PrintAverageHashTimer(object? state) Logger.PrintCpuMinerSpeed(_logger, _cpuMiner.AverageHashCalculatedIn10Seconds.Sum(), _cpuMiner.AverageHashCalculatedIn60Seconds.Sum(), _cpuMiner.AverageHashCalculatedIn15Minutes.Sum(), _maxHash); } - private void CpuMinerOnFoundBlock(int height, string jobType, bool isGoodBlock, string reason, double roundTripTime) + private void CpuMinerOnFoundBlock(long height, string jobType, bool isGoodBlock, string reason, double roundTripTime) { lock (_lastFoundHeightLock) { diff --git a/Xenorig/ConsoleService.cs b/Xenorig/ConsoleService.cs index 90cff41..9d8aba4 100644 --- a/Xenorig/ConsoleService.cs +++ b/Xenorig/ConsoleService.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.Options; using Xenolib.Utilities; using Xenorig.Algorithms; -using Xenorig.Algorithms.Xenophyte.Centralized; using Xenorig.Algorithms.Xenophyte.Centralized.Solo; using Xenorig.Options; @@ -16,7 +15,7 @@ public sealed class ConsoleService : BackgroundService private readonly XenorigOptions _options; private IAlgorithm[] _minerInstances = Array.Empty(); - private readonly int _currentIndex = 0; + private int _currentIndex = 0; public ConsoleService(ILogger logger, ILoggerFactory loggerFactory, IOptions options) { diff --git a/Xenorig/Logger.cs b/Xenorig/Logger.cs index 4ee1413..9139916 100644 --- a/Xenorig/Logger.cs +++ b/Xenorig/Logger.cs @@ -39,7 +39,7 @@ public static partial class Logger public static partial void PrintCpuMinerReady(ILogger logger, int threads); [LoggerMessage(EventId = 12, Level = LogLevel.Information, Message = $"{MagentaForegroundColor}{{job}}{Reset} from {WhiteForegroundColor}{{host}}{Reset} diff {WhiteForegroundColor}{{difficulty}}{Reset} algo {WhiteForegroundColor}{{algorithm}}{Reset} height {WhiteForegroundColor}{{height}}{Reset}")] - public static partial void PrintJob(ILogger logger, string job, string host, long difficulty, string algorithm, int height); + public static partial void PrintJob(ILogger logger, string job, string host, long difficulty, string algorithm, long height); [LoggerMessage(EventId = 13, Level = LogLevel.Information, Message = $"{BlueForegroundColor}Thread: {{threadId,-2}} | Job Type: {{jobType}} | Job Chunk: {{startIndex}}-{{endIndex}} ({{size}}){Reset}")] public static partial void PrintCurrentChunkedThreadJob(ILogger logger, int threadId, string jobType, long startIndex, long endIndex, long size); diff --git a/Xenorig/Xenorig.csproj b/Xenorig/Xenorig.csproj index 94f5106..3b2a1ee 100644 --- a/Xenorig/Xenorig.csproj +++ b/Xenorig/Xenorig.csproj @@ -144,8 +144,4 @@ - - - - \ No newline at end of file