diff --git a/src/Miningcore.Tests/Miningcore.Tests.csproj b/src/Miningcore.Tests/Miningcore.Tests.csproj
index 7d2b4bb0d..a41b1c9aa 100644
--- a/src/Miningcore.Tests/Miningcore.Tests.csproj
+++ b/src/Miningcore.Tests/Miningcore.Tests.csproj
@@ -37,7 +37,7 @@
-
+
diff --git a/src/Miningcore/AutofacModule.cs b/src/Miningcore/AutofacModule.cs
index bc4d963e2..59bdb8eb1 100644
--- a/src/Miningcore/AutofacModule.cs
+++ b/src/Miningcore/AutofacModule.cs
@@ -61,9 +61,12 @@ protected override void Load(ContainerBuilder builder)
.SingleInstance();
builder.RegisterInstance(new RecyclableMemoryStreamManager
- {
- ThrowExceptionOnToArray = true
- });
+ (
+ new RecyclableMemoryStreamManager.Options
+ {
+ ThrowExceptionOnToArray = true
+ }
+ ));
builder.RegisterType()
.AsImplementedInterfaces()
diff --git a/src/Miningcore/Blockchain/Alephium/AlephiumPool.cs b/src/Miningcore/Blockchain/Alephium/AlephiumPool.cs
index 31e9e79d7..99c3f5c66 100644
--- a/src/Miningcore/Blockchain/Alephium/AlephiumPool.cs
+++ b/src/Miningcore/Blockchain/Alephium/AlephiumPool.cs
@@ -355,6 +355,11 @@ protected override async Task OnRequestAsync(StratumConnection connection,
break;
}
}
+
+ catch(AlephiumStratumException ex)
+ {
+ await connection.RespondAsync(new JsonRpcResponse(new JsonRpcError((int) ex.Code, ex.Message, null), request.Id, false));
+ }
catch(StratumException ex)
{
diff --git a/src/Miningcore/Blockchain/Beam/BeamBlockHeader.cs b/src/Miningcore/Blockchain/Beam/BeamBlockHeader.cs
index eb02f5369..1e8464f94 100644
--- a/src/Miningcore/Blockchain/Beam/BeamBlockHeader.cs
+++ b/src/Miningcore/Blockchain/Beam/BeamBlockHeader.cs
@@ -91,10 +91,10 @@ public void ReadWrite(BitcoinStream stream)
stream.ReadWrite(ref nVersion);
stream.ReadWrite(ref hashPrevBlock);
stream.ReadWrite(ref hashMerkleRoot);
- stream.ReadWrite(ref hashReserved);
+ stream.ReadWrite(hashReserved);
stream.ReadWrite(ref nTime);
stream.ReadWrite(ref nBits);
- stream.ReadWrite(ref nonceBytes);
+ stream.ReadWrite(nonceBytes);
}
#endregion
diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
index c695cb07d..76b3026cf 100644
--- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
+++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
@@ -107,12 +107,12 @@ protected virtual void BuildCoinbase()
// serialize (simulated) input transaction
bs.ReadWriteAsVarInt(ref txInputCount);
- bs.ReadWrite(ref sha256Empty);
+ bs.ReadWrite(sha256Empty);
bs.ReadWrite(ref txInPrevOutIndex);
// signature script initial part
bs.ReadWriteAsVarInt(ref sigScriptLength);
- bs.ReadWrite(ref sigScriptInitialBytes);
+ bs.ReadWrite(sigScriptInitialBytes);
// done
coinbaseInitial = stream.ToArray();
@@ -125,14 +125,14 @@ protected virtual void BuildCoinbase()
var bs = new BitcoinStream(stream, true);
// signature script final part
- bs.ReadWrite(ref scriptSigFinalBytes);
+ bs.ReadWrite(scriptSigFinalBytes);
// tx in sequence
bs.ReadWrite(ref txInSequence);
// serialize output transaction
var txOutBytes = SerializeOutputTransaction(txOut);
- bs.ReadWrite(ref txOutBytes);
+ bs.ReadWrite(txOutBytes);
// misc
bs.ReadWrite(ref txLockTime);
@@ -189,7 +189,7 @@ protected virtual byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
// serialize outputs
@@ -202,7 +202,7 @@ protected virtual byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
return stream.ToArray();
@@ -400,11 +400,11 @@ protected virtual byte[] SerializeBlock(byte[] header, byte[] coinbase)
{
var bs = new BitcoinStream(stream, true);
- bs.ReadWrite(ref header);
+ bs.ReadWrite(header);
bs.ReadWriteAsVarInt(ref transactionCount);
- bs.ReadWrite(ref coinbase);
- bs.ReadWrite(ref rawTransactionBuffer);
+ bs.ReadWrite(coinbase);
+ bs.ReadWrite(rawTransactionBuffer);
// POS coins require a zero byte appended to block which the daemon replaces with the signature
if(isPoS)
@@ -418,8 +418,8 @@ protected virtual byte[] SerializeBlock(byte[] header, byte[] coinbase)
var mweb = BlockTemplate.Extra.SafeExtensionDataAs();
var mwebRaw = mweb.Mweb.HexToByteArray();
- bs.ReadWrite(ref separator);
- bs.ReadWrite(ref mwebRaw);
+ bs.ReadWrite(separator);
+ bs.ReadWrite(mwebRaw);
}
return stream.ToArray();
diff --git a/src/Miningcore/Blockchain/Equihash/Custom/BitcoinGold/BitcoinGoldJob.cs b/src/Miningcore/Blockchain/Equihash/Custom/BitcoinGold/BitcoinGoldJob.cs
index 2f493bab7..cdf39bd05 100644
--- a/src/Miningcore/Blockchain/Equihash/Custom/BitcoinGold/BitcoinGoldJob.cs
+++ b/src/Miningcore/Blockchain/Equihash/Custom/BitcoinGold/BitcoinGoldJob.cs
@@ -48,14 +48,14 @@ protected override void BuildCoinbase()
// serialize (simulated) input transaction
bs.ReadWriteAsVarInt(ref txInputCount);
- bs.ReadWrite(ref sha256Empty);
+ bs.ReadWrite(sha256Empty);
bs.ReadWrite(ref coinbaseIndex);
bs.ReadWrite(ref script);
bs.ReadWrite(ref coinbaseSequence);
// serialize output transaction
var txOutBytes = SerializeOutputTransaction(txOut);
- bs.ReadWrite(ref txOutBytes);
+ bs.ReadWrite(txOutBytes);
// misc
bs.ReadWrite(ref txLockTime);
@@ -95,7 +95,7 @@ private byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
// serialize outputs
@@ -108,7 +108,7 @@ private byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
return stream.ToArray();
diff --git a/src/Miningcore/Blockchain/Equihash/Custom/Veruscoin/VeruscoinJob.cs b/src/Miningcore/Blockchain/Equihash/Custom/Veruscoin/VeruscoinJob.cs
index 5a5f39be0..75463ddd6 100644
--- a/src/Miningcore/Blockchain/Equihash/Custom/Veruscoin/VeruscoinJob.cs
+++ b/src/Miningcore/Blockchain/Equihash/Custom/Veruscoin/VeruscoinJob.cs
@@ -197,7 +197,7 @@ protected override void BuildCoinbase()
// serialize (simulated) input transaction
bs.ReadWriteAsVarInt(ref txInputCount);
- bs.ReadWrite(ref sha256Empty);
+ bs.ReadWrite(sha256Empty);
bs.ReadWrite(ref coinbaseIndex);
// bs.ReadWrite(ref serializedBlockHeightBytes);
bs.ReadWrite(ref script);
@@ -205,7 +205,7 @@ protected override void BuildCoinbase()
// serialize output transaction
var txOutBytes = SerializeOutputTransaction(txOut);
- bs.ReadWrite(ref txOutBytes);
+ bs.ReadWrite(txOutBytes);
// misc
bs.ReadWrite(ref txLockTime);
@@ -269,7 +269,7 @@ private byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
// serialize witness (segwit)
@@ -281,7 +281,7 @@ private byte[] SerializeOutputTransaction(Transaction tx)
bs.ReadWrite(ref amount);
bs.ReadWriteAsVarInt(ref rawLength);
- bs.ReadWrite(ref raw);
+ bs.ReadWrite(raw);
}
return stream.ToArray();
@@ -311,8 +311,8 @@ private byte[] SerializeVeruscoinBlock(Span header, Span coinbase, S
{
var bs = new BitcoinStream(stream, true);
- bs.ReadWrite(ref header);
- bs.ReadWrite(ref solution);
+ bs.ReadWrite(header);
+ bs.ReadWrite(solution);
/* var txCount = transactionCount.ToString();
if (Math.Abs(txCount.Length % 2) == 1)
@@ -341,8 +341,8 @@ private byte[] SerializeVeruscoinBlock(Span header, Span coinbase, S
} */
bs.ReadWriteAsVarInt(ref transactionCount);
- bs.ReadWrite(ref coinbase);
- bs.ReadWrite(ref rawTransactionBuffer);
+ bs.ReadWrite(coinbase);
+ bs.ReadWrite(rawTransactionBuffer);
return stream.ToArray();
}
diff --git a/src/Miningcore/Blockchain/Equihash/EquihashBlockHeader.cs b/src/Miningcore/Blockchain/Equihash/EquihashBlockHeader.cs
index 5580c1594..b78ef17e2 100644
--- a/src/Miningcore/Blockchain/Equihash/EquihashBlockHeader.cs
+++ b/src/Miningcore/Blockchain/Equihash/EquihashBlockHeader.cs
@@ -91,10 +91,10 @@ public void ReadWrite(BitcoinStream stream)
stream.ReadWrite(ref nVersion);
stream.ReadWrite(ref hashPrevBlock);
stream.ReadWrite(ref hashMerkleRoot);
- stream.ReadWrite(ref hashReserved);
+ stream.ReadWrite(hashReserved);
stream.ReadWrite(ref nTime);
stream.ReadWrite(ref nBits);
- stream.ReadWrite(ref nonceBytes);
+ stream.ReadWrite(nonceBytes);
}
#endregion
diff --git a/src/Miningcore/Blockchain/Equihash/EquihashJob.cs b/src/Miningcore/Blockchain/Equihash/EquihashJob.cs
index cb1753e3e..db245d578 100644
--- a/src/Miningcore/Blockchain/Equihash/EquihashJob.cs
+++ b/src/Miningcore/Blockchain/Equihash/EquihashJob.cs
@@ -216,11 +216,11 @@ private byte[] SerializeBlock(Span header, Span coinbase, Span
{
var bs = new BitcoinStream(stream, true);
- bs.ReadWrite(ref header);
- bs.ReadWrite(ref solution);
+ bs.ReadWrite(header);
+ bs.ReadWrite(solution);
bs.ReadWriteAsVarInt(ref transactionCount);
- bs.ReadWrite(ref coinbase);
- bs.ReadWrite(ref rawTransactionBuffer);
+ bs.ReadWrite(coinbase);
+ bs.ReadWrite(rawTransactionBuffer);
return stream.ToArray();
}
diff --git a/src/Miningcore/Blockchain/Progpow/ProgpowJob.cs b/src/Miningcore/Blockchain/Progpow/ProgpowJob.cs
index 160f73251..23798edab 100644
--- a/src/Miningcore/Blockchain/Progpow/ProgpowJob.cs
+++ b/src/Miningcore/Blockchain/Progpow/ProgpowJob.cs
@@ -156,13 +156,13 @@ protected virtual byte[] SerializeBlock(byte[] header, byte[] coinbase, ulong no
{
var bs = new BitcoinStream(stream, true);
- bs.ReadWrite(ref header);
+ bs.ReadWrite(header);
bs.ReadWrite(ref nonce);
- bs.ReadWrite(ref mixHash);
+ bs.ReadWrite(mixHash);
bs.ReadWriteAsVarInt(ref transactionCount);
- bs.ReadWrite(ref coinbase);
- bs.ReadWrite(ref rawTransactionBuffer);
+ bs.ReadWrite(coinbase);
+ bs.ReadWrite(rawTransactionBuffer);
return stream.ToArray();
}
diff --git a/src/Miningcore/Configuration/ClusterConfigExtensions.cs b/src/Miningcore/Configuration/ClusterConfigExtensions.cs
index 247132011..1da7175b4 100644
--- a/src/Miningcore/Configuration/ClusterConfigExtensions.cs
+++ b/src/Miningcore/Configuration/ClusterConfigExtensions.cs
@@ -233,7 +233,7 @@ public partial class EthereumCoinTemplate
public EthereumCoinTemplate()
{
ethashLightValue = new Lazy(() =>
- EthashFactory.GetEthash(ComponentContext, Ethasher));
+ EthashFactory.GetEthash(Symbol, ComponentContext, Ethasher));
}
private readonly Lazy ethashLightValue;
@@ -278,7 +278,7 @@ public partial class ProgpowCoinTemplate
public ProgpowCoinTemplate() : base()
{
progpowLightValue = new Lazy(() =>
- ProgpowFactory.GetProgpow(ComponentContext, Progpower));
+ ProgpowFactory.GetProgpow(Symbol, ComponentContext, Progpower));
}
private readonly Lazy progpowLightValue;
diff --git a/src/Miningcore/Crypto/Hashing/Ethash/EthashFactory.cs b/src/Miningcore/Crypto/Hashing/Ethash/EthashFactory.cs
index 4d833075a..26f936434 100644
--- a/src/Miningcore/Crypto/Hashing/Ethash/EthashFactory.cs
+++ b/src/Miningcore/Crypto/Hashing/Ethash/EthashFactory.cs
@@ -7,18 +7,18 @@ public static class EthashFactory
{
private static readonly ConcurrentDictionary cacheFull = new();
- public static IEthashLight GetEthash(IComponentContext ctx, string name)
+ public static IEthashLight GetEthash(string symbol, IComponentContext ctx, string name)
{
- if(name == "")
+ if(string.IsNullOrEmpty(symbol) || string.IsNullOrEmpty(name))
return null;
// check cache
- if(cacheFull.TryGetValue(name, out var result))
+ if(cacheFull.TryGetValue(symbol, out var result))
return result;
result = ctx.ResolveNamed(name);
- cacheFull.TryAdd(name, result);
+ cacheFull.TryAdd(symbol, result);
return result;
}
diff --git a/src/Miningcore/Crypto/Hashing/Progpow/ProgpowFactory.cs b/src/Miningcore/Crypto/Hashing/Progpow/ProgpowFactory.cs
index 517570882..efe710e55 100644
--- a/src/Miningcore/Crypto/Hashing/Progpow/ProgpowFactory.cs
+++ b/src/Miningcore/Crypto/Hashing/Progpow/ProgpowFactory.cs
@@ -7,18 +7,18 @@ public static class ProgpowFactory
{
private static readonly ConcurrentDictionary cacheFull = new();
- public static IProgpowLight GetProgpow(IComponentContext ctx, string name)
+ public static IProgpowLight GetProgpow(string symbol, IComponentContext ctx, string name)
{
- if(name == "")
+ if(string.IsNullOrEmpty(symbol) || string.IsNullOrEmpty(name))
return null;
// check cache
- if(cacheFull.TryGetValue(name, out var result))
+ if(cacheFull.TryGetValue(symbol, out var result))
return result;
result = ctx.ResolveNamed(name);
- cacheFull.TryAdd(name, result);
+ cacheFull.TryAdd(symbol, result);
return result;
}
diff --git a/src/Miningcore/Miningcore.csproj b/src/Miningcore/Miningcore.csproj
index 60752cbe0..846867118 100644
--- a/src/Miningcore/Miningcore.csproj
+++ b/src/Miningcore/Miningcore.csproj
@@ -49,40 +49,40 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
+
-
+
diff --git a/src/Miningcore/Payments/PaymentSchemes/PPLNSPaymentScheme.cs b/src/Miningcore/Payments/PaymentSchemes/PPLNSPaymentScheme.cs
index a1b424ae5..d2c5b1199 100644
--- a/src/Miningcore/Payments/PaymentSchemes/PPLNSPaymentScheme.cs
+++ b/src/Miningcore/Payments/PaymentSchemes/PPLNSPaymentScheme.cs
@@ -43,7 +43,7 @@ public PPLNSPaymentScheme(
private readonly IBlockRepository blockRepo;
private readonly IConnectionFactory cf;
private readonly IShareRepository shareRepo;
- private static readonly ILogger logger = LogManager.GetLogger("PPLNS Payment", typeof(PPLNSPaymentScheme));
+ private static readonly ILogger logger = LogManager.GetLogger("PPLNS Payment");
private const int RetryCount = 4;
private IAsyncPolicy shareReadFaultPolicy;
diff --git a/src/Miningcore/Payments/PaymentSchemes/PROPPaymentScheme.cs b/src/Miningcore/Payments/PaymentSchemes/PROPPaymentScheme.cs
index 69c0b73b0..6f21925bf 100644
--- a/src/Miningcore/Payments/PaymentSchemes/PROPPaymentScheme.cs
+++ b/src/Miningcore/Payments/PaymentSchemes/PROPPaymentScheme.cs
@@ -43,7 +43,7 @@ public PROPPaymentScheme(
private readonly IBlockRepository blockRepo;
private readonly IConnectionFactory cf;
private readonly IShareRepository shareRepo;
- private static readonly ILogger logger = LogManager.GetLogger("PROP Payment", typeof(PROPPaymentScheme));
+ private static readonly ILogger logger = LogManager.GetLogger("PROP Payment");
private const int RetryCount = 4;
private IAsyncPolicy shareReadFaultPolicy;
diff --git a/src/Miningcore/Payments/PaymentSchemes/SOLOPaymentScheme.cs b/src/Miningcore/Payments/PaymentSchemes/SOLOPaymentScheme.cs
index 9d87bd1ff..0c204bab0 100644
--- a/src/Miningcore/Payments/PaymentSchemes/SOLOPaymentScheme.cs
+++ b/src/Miningcore/Payments/PaymentSchemes/SOLOPaymentScheme.cs
@@ -26,7 +26,7 @@ public SOLOPaymentScheme(
private readonly IBalanceRepository balanceRepo;
private readonly IShareRepository shareRepo;
- private static readonly ILogger logger = LogManager.GetLogger("SOLO Payment", typeof(SOLOPaymentScheme));
+ private static readonly ILogger logger = LogManager.GetLogger("SOLO Payment");
#region IPayoutScheme
diff --git a/src/Miningcore/Program.cs b/src/Miningcore/Program.cs
index 102d09a5e..a75860efa 100644
--- a/src/Miningcore/Program.cs
+++ b/src/Miningcore/Program.cs
@@ -780,8 +780,10 @@ private static async Task PreFlightChecks(IServiceProvider services)
var rmsm = services.GetService();
// Configure RecyclableMemoryStream
- rmsm.MaximumFreeSmallPoolBytes = clusterConfig.Memory?.RmsmMaximumFreeSmallPoolBytes ?? 0x100000; // 1 MB
- rmsm.MaximumFreeLargePoolBytes = clusterConfig.Memory?.RmsmMaximumFreeLargePoolBytes ?? 0x800000; // 8 MB
+ var rmsmOptions = rmsm.Settings;
+ rmsmOptions.MaximumSmallPoolFreeBytes = clusterConfig.Memory?.RmsmMaximumFreeSmallPoolBytes ?? 0x100000; // 1 MB
+ rmsmOptions.MaximumLargePoolFreeBytes = clusterConfig.Memory?.RmsmMaximumFreeLargePoolBytes ?? 0x800000; // 8 MB
+ rmsm = new RecyclableMemoryStreamManager(rmsmOptions);
// Configure Equihash
EquihashSolver.messageBus = messageBus;