From 87744ce24c655c63177f7566922f1fb564e5d197 Mon Sep 17 00:00:00 2001 From: Vladimir_P Date: Sun, 2 Apr 2023 23:45:02 +0500 Subject: [PATCH] PartyChain add PartyChain --- .../Blockchain/Ethereum/EthereumConstants.cs | 8 +++++++- .../Blockchain/Ethereum/EthereumPayoutHandler.cs | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Miningcore/Blockchain/Ethereum/EthereumConstants.cs b/src/Miningcore/Blockchain/Ethereum/EthereumConstants.cs index e89ec7cb55..4846391689 100644 --- a/src/Miningcore/Blockchain/Ethereum/EthereumConstants.cs +++ b/src/Miningcore/Blockchain/Ethereum/EthereumConstants.cs @@ -34,6 +34,7 @@ public class EthereumConstants public const decimal ByzantiumBlockReward = 3.0m; public const decimal ConstantinopleReward = 2.0m; public const decimal PinkchainReward = 1.0m; + public const int MinConfimations = 16; @@ -62,7 +63,10 @@ public class MineOnliumConstants { public const decimal BaseRewardInitial = 2.0m; } - +public class PartyConstants +{ + public const decimal BaseRewardInitial = .1m; +} public enum EthereumNetworkType { @@ -70,6 +74,7 @@ public enum EthereumNetworkType Ropsten = 3, Callisto = 820, MainPow = 10001, + PartyChain = 1773, EtherOne = 4949, PinkChain = 10100, MineOnlium = 54321, @@ -83,6 +88,7 @@ public enum GethChainType Ropsten, Callisto, MainPow = 10001, + PartyChain = 1773, EtherOne = 4949, PinkChain = 10100, MineOnlium = 54321, diff --git a/src/Miningcore/Blockchain/Ethereum/EthereumPayoutHandler.cs b/src/Miningcore/Blockchain/Ethereum/EthereumPayoutHandler.cs index 204a5839f5..0165c83331 100644 --- a/src/Miningcore/Blockchain/Ethereum/EthereumPayoutHandler.cs +++ b/src/Miningcore/Blockchain/Ethereum/EthereumPayoutHandler.cs @@ -130,7 +130,7 @@ public async Task ClassifyBlocksAsync(IMiningPool pool, Block[] blocks, var gasUsed = blockHashResponse.Response.GasUsed; var burnedFee = (decimal) 0; - if(extraPoolConfig?.ChainTypeOverride == "Ethereum" || extraPoolConfig?.ChainTypeOverride == "Main" || extraPoolConfig?.ChainTypeOverride == "MainPow" || extraPoolConfig?.ChainTypeOverride == "PinkChain" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "MineOnlium") + if(extraPoolConfig?.ChainTypeOverride == "Ethereum" || extraPoolConfig?.ChainTypeOverride == "Main" || extraPoolConfig?.ChainTypeOverride == "MainPow" || extraPoolConfig?.ChainTypeOverride == "PinkChain" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "MineOnlium" || extraPoolConfig?.ChainTypeOverride == "PartyChain") burnedFee = (baseGas * gasUsed / EthereumConstants.Wei); block.Hash = blockHash; @@ -242,7 +242,7 @@ public async Task PayoutAsync(IMiningPool pool, Balance[] balances, Cancellation // ensure we have peers var infoResponse = await rpcClient.ExecuteAsync(logger, EC.GetPeerCount, ct); - if((networkType == EthereumNetworkType.Main || networkType == EthereumNetworkType.MainPow || extraPoolConfig?.ChainTypeOverride == "PinkChain" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "MineOnlium") && + if((networkType == EthereumNetworkType.Main || networkType == EthereumNetworkType.MainPow || extraPoolConfig?.ChainTypeOverride == "PinkChain" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "MineOnlium" || extraPoolConfig?.ChainTypeOverride == "PartyChain") && (infoResponse.Error != null || string.IsNullOrEmpty(infoResponse.Response) || infoResponse.Response.IntegralFromHex() < EthereumConstants.MinPayoutPeerCount)) { @@ -332,6 +332,9 @@ internal static decimal GetBaseBlockReward(GethChainType chainType, ulong height case GethChainType.PinkChain: return PinkConstants.BaseRewardInitial; + case GethChainType.PartyChain: + return PartyConstants.BaseRewardInitial; + default: throw new Exception("Unable to determine block reward: Unsupported chain type"); } @@ -429,6 +432,8 @@ private async Task PayoutAsync(Balance balance, CancellationToken ct) response = await rpcClient.ExecuteAsync(logger, EC.SendTx, ct, new[] { requestPink }); } + + else if(extraPoolConfig?.ChainTypeOverride == "MineOnlium") { var requestMineonlium = new SendTransactionRequestMineonlium @@ -442,6 +447,8 @@ private async Task PayoutAsync(Balance balance, CancellationToken ct) }; response = await walletClient.ExecuteAsync(logger, EC.SendTx, ct, new[] { requestMineonlium }); } + + else { response = await rpcClient.ExecuteAsync(logger, EC.SendTx, ct, new[] { request }); }