diff --git a/examples/litecoin_dash_pool.json b/examples/litecoin_dash_pool.json
index 56d85f6cf1..59ff2c6289 100644
--- a/examples/litecoin_dash_pool.json
+++ b/examples/litecoin_dash_pool.json
@@ -86,7 +86,8 @@
"payoutSchemeConfig": {
"factor": 2.0
}
- }
+ },
+ "addressType": "litecoin"
},
{
"id": "dash1",
diff --git a/examples/litecoin_pool.json b/examples/litecoin_pool.json
index b2482b2579..72a801d412 100644
--- a/examples/litecoin_pool.json
+++ b/examples/litecoin_pool.json
@@ -90,6 +90,7 @@
"payoutSchemeConfig": {
"factor": 2.0
}
- }
+ },
+ "addressType": "litecoin"
}]
}
\ No newline at end of file
diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs
index 0db3cd3bde..025403bdb8 100644
--- a/src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs
+++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs
@@ -19,6 +19,11 @@ public enum BitcoinAddressType
/// Bitcoin Cash
///
BCash,
+
+ ///
+ /// Litecoin
+ ///
+ Litecoin
}
public enum BitcoinTransactionCategory
diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
index 0557ac0762..7bff0b6a23 100644
--- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
+++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs
@@ -243,10 +243,10 @@ protected virtual Transaction CreateOutputTransaction()
if(coin.HasMasterNodes)
rewardToPool = CreateMasternodeOutputs(tx, rewardToPool);
- if (coin.HasFounderFee)
+ if(coin.HasFounderFee)
rewardToPool = CreateFounderOutputs(tx, rewardToPool);
- if (coin.HasMinerFund)
+ if(coin.HasMinerFund)
rewardToPool = CreateMinerFundOutputs(tx, rewardToPool);
// Remaining amount goes to pool
@@ -410,6 +410,18 @@ protected virtual byte[] SerializeBlock(byte[] header, byte[] coinbase)
if(isPoS)
bs.ReadWrite((byte) 0);
+ // if pool supports MWEB, we have to append the MWEB data to the block
+ // https://github.com/litecoin-project/litecoin/blob/0.21/doc/mweb/mining-changes.md
+ if(coin.HasMWEB)
+ {
+ var separator = new byte[] { 0x01 };
+ var mweb = BlockTemplate.Extra.SafeExtensionDataAs();
+ var mwebRaw = mweb.Mweb.HexToByteArray();
+
+ bs.ReadWrite(ref separator);
+ bs.ReadWrite(ref mwebRaw);
+ }
+
return stream.ToArray();
}
}
@@ -492,10 +504,10 @@ protected virtual Money CreateMasternodeOutputs(Transaction tx, Money reward)
protected virtual Money CreateFounderOutputs(Transaction tx, Money reward)
{
- if (founderParameters.Founder != null)
+ if(founderParameters.Founder != null)
{
Founder[] founders;
- if (founderParameters.Founder.Type == JTokenType.Array)
+ if(founderParameters.Founder.Type == JTokenType.Array)
founders = founderParameters.Founder.ToObject();
else
founders = new[] { founderParameters.Founder.ToObject() };
@@ -529,7 +541,7 @@ protected virtual Money CreateMinerFundOutputs(Transaction tx, Money reward)
{
var payeeReward = minerFundParameters.MinimumValue;
- if (!string.IsNullOrEmpty(minerFundParameters.Addresses?.FirstOrDefault()))
+ if(!string.IsNullOrEmpty(minerFundParameters.Addresses?.FirstOrDefault()))
{
var payeeAddress = BitcoinUtils.AddressToDestination(minerFundParameters.Addresses[0], network);
tx.Outputs.Add(payeeReward, payeeAddress);
@@ -612,10 +624,10 @@ public void Init(BlockTemplate blockTemplate, string jobId,
if(coin.HasPayee)
payeeParameters = BlockTemplate.Extra.SafeExtensionDataAs();
- if (coin.HasFounderFee)
+ if(coin.HasFounderFee)
founderParameters = BlockTemplate.Extra.SafeExtensionDataAs();
- if (coin.HasMinerFund)
+ if(coin.HasMinerFund)
minerFundParameters = BlockTemplate.Extra.SafeExtensionDataAs("coinbasetxn", "minerfund");
this.coinbaseHasher = coinbaseHasher;
diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs
index b8df94e376..14675f4515 100644
--- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs
+++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs
@@ -13,6 +13,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NLog;
+using Org.BouncyCastle.Crypto.Parameters;
namespace Miningcore.Blockchain.Bitcoin;
@@ -33,17 +34,61 @@ protected override object[] GetBlockTemplateParams()
{
var result = base.GetBlockTemplateParams();
+ if(coin.HasMWEB)
+ {
+ result = new object[]
+ {
+ new
+ {
+ rules = new[] {"segwit", "mweb"},
+ }
+ };
+ }
+
if(coin.BlockTemplateRpcExtraParams != null)
{
if(coin.BlockTemplateRpcExtraParams.Type == JTokenType.Array)
result = result.Concat(coin.BlockTemplateRpcExtraParams.ToObject