From 99490088f9c9dc1a8ea0e4b9e3fcdcfab90b81bc Mon Sep 17 00:00:00 2001 From: jon4hz Date: Wed, 28 Dec 2022 01:29:36 +0100 Subject: [PATCH 1/6] fix: add mweb to ltc blockTemplateRpcExtraParams --- src/Miningcore/coins.json | 544 +++++++++----------------------------- 1 file changed, 121 insertions(+), 423 deletions(-) diff --git a/src/Miningcore/coins.json b/src/Miningcore/coins.json index bc624a715..40c986f51 100644 --- a/src/Miningcore/coins.json +++ b/src/Miningcore/coins.json @@ -60,9 +60,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "sha256d" - ], + "blockTemplateRpcExtraParams": ["sha256d"], "explorerBlockLink": "https://chainz.cryptoid.info/aur/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/aur/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/aur/address.dws?{0}.htm" @@ -82,10 +80,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -95,9 +90,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "scrypt" - ], + "blockTemplateRpcExtraParams": ["scrypt"], "shareMultiplier": 65536, "explorerBlockLink": "https://chainz.cryptoid.info/aur/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/aur/tx.dws?{0}.htm", @@ -127,9 +120,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "skein" - ], + "blockTemplateRpcExtraParams": ["skein"], "explorerBlockLink": "https://chainz.cryptoid.info/aur/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/aur/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/aur/address.dws?{0}.htm" @@ -158,9 +149,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "qubit" - ], + "blockTemplateRpcExtraParams": ["qubit"], "explorerBlockLink": "https://chainz.cryptoid.info/aur/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/aur/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/aur/address.dws?{0}.htm" @@ -190,9 +179,7 @@ ] }, "shareMultiplier": 4096, - "blockTemplateRpcExtraParams": [ - "groestl" - ], + "blockTemplateRpcExtraParams": ["groestl"], "explorerBlockLink": "https://chainz.cryptoid.info/aur/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/aur/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/aur/address.dws?{0}.htm" @@ -212,10 +199,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -273,10 +257,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -542,9 +523,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "sha256d" - ], + "blockTemplateRpcExtraParams": ["sha256d"], "hasFounderFee": true, "hasMasterNodes": true, "explorerBlockLink": "https://blocks.butcoin.tech/block/$hash$", @@ -566,10 +545,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -584,10 +560,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -707,9 +680,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "sha256d" - ], + "blockTemplateRpcExtraParams": ["sha256d"], "explorerBlockLink": "https://chainz.cryptoid.info/dgb/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/dgb/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/dgb/address.dws?{0}.htm" @@ -729,10 +700,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -743,9 +711,7 @@ ] }, "shareMultiplier": 65536, - "blockTemplateRpcExtraParams": [ - "scrypt" - ], + "blockTemplateRpcExtraParams": ["scrypt"], "explorerBlockLink": "https://chainz.cryptoid.info/dgb/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/dgb/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/dgb/address.dws?{0}.htm" @@ -774,9 +740,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "skein" - ], + "blockTemplateRpcExtraParams": ["skein"], "explorerBlockLink": "https://chainz.cryptoid.info/dgb/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/dgb/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/dgb/address.dws?{0}.htm" @@ -805,9 +769,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "qubit" - ], + "blockTemplateRpcExtraParams": ["qubit"], "explorerBlockLink": "https://chainz.cryptoid.info/dgb/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/dgb/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/dgb/address.dws?{0}.htm" @@ -837,9 +799,7 @@ ] }, "shareMultiplier": 256, - "blockTemplateRpcExtraParams": [ - "groestl" - ], + "blockTemplateRpcExtraParams": ["groestl"], "explorerBlockLink": "https://chainz.cryptoid.info/dgb/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/dgb/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/dgb/address.dws?{0}.htm" @@ -859,10 +819,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1094,18 +1051,14 @@ }, "headerHasher": { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] }, "blockHasher": { "hash": "reverse", "args": [ { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] } ] }, @@ -1128,10 +1081,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1146,10 +1096,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -1173,10 +1120,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1191,10 +1135,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -1372,10 +1313,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1390,10 +1328,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -1510,10 +1445,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1528,13 +1460,11 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, + "blockTemplateRpcExtraParams": ["mweb"], "shareMultiplier": 65536, "explorerBlockLink": "https://chainz.cryptoid.info/ltc/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/ltc/tx.dws?{0}.htm", @@ -1582,18 +1512,14 @@ }, "headerHasher": { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] }, "blockHasher": { "hash": "reverse", "args": [ { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] } ] }, @@ -1645,10 +1571,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1707,10 +1630,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1725,10 +1645,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -1780,10 +1697,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1798,10 +1712,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -1879,10 +1790,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -1897,10 +1805,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2008,10 +1913,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2026,10 +1928,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2083,10 +1982,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2101,10 +1997,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2170,9 +2063,7 @@ "hasFounderFee": true, "hasMasterNodes": true, "hasSmartNodes": true, - "foundersRewardAddress": [ - "RTtyQU6DoSuNWetT4WUem5qXP5jNYGpwat" - ], + "foundersRewardAddress": ["RTtyQU6DoSuNWetT4WUem5qXP5jNYGpwat"], "shareMultiplier": 65536, "explorerBlockLink": "https://explorer.raptoreum.com/block-height/$height$", "explorerTxLink": "https://explorer.raptoreum.com/tx/{0}", @@ -2203,9 +2094,7 @@ }, "hasFounderFee": true, "hasMasterNodes": true, - "foundersRewardAddress": [ - "GZBNAiLokyYvSwNLftReXuYbvdmzNoorGj" - ], + "foundersRewardAddress": ["GZBNAiLokyYvSwNLftReXuYbvdmzNoorGj"], "shareMultiplier": 65536, "explorerBlockLink": "https://explorer.globalsocialpost.com/block/$height$", "explorerTxLink": "https://explorer.globalsocialpost.com/tx/{0}", @@ -2223,29 +2112,29 @@ }, "blockHasher": { "hash": "reverse", - "args": [ { "hash": "sha512/256d" } ] + "args": [{ "hash": "sha512/256d" }] }, "explorerBlockLink": "https://explorer.radiantblockchain.org/block-height/$height$", "explorerTxLink": "https://explorer.radiantblockchain.org/tx/{0}", "explorerAccountLink": "https://explorer.radiantblockchain.org/address/{0}" }, "novo": { - "name": "Novo", - "symbol": "NOVO", - "family": "bitcoin", - "coinbaseHasher": { - "hash": "sha256d" - }, - "headerHasher": { - "hash": "sha256dt" - }, - "blockHasher": { - "hash": "reverse", - "args": [ { "hash": "sha256dt" } ] - }, - "explorerBlockLink": "https://explorer.novochain.ovh/block/$height$", - "explorerTxLink": "https://explorer.novochain.ovh/tx/{0}", - "explorerAccountLink": "https://explorer.novochain.ovh/address/{0}" + "name": "Novo", + "symbol": "NOVO", + "family": "bitcoin", + "coinbaseHasher": { + "hash": "sha256d" + }, + "headerHasher": { + "hash": "sha256dt" + }, + "blockHasher": { + "hash": "reverse", + "args": [{ "hash": "sha256dt" }] + }, + "explorerBlockLink": "https://explorer.novochain.ovh/block/$height$", + "explorerTxLink": "https://explorer.novochain.ovh/tx/{0}", + "explorerAccountLink": "https://explorer.novochain.ovh/address/{0}" }, "bitoreum": { "name": "Bitoreum", @@ -2273,9 +2162,7 @@ "hasFounderFee": true, "hasMasterNodes": true, "hasSmartNodes": true, - "foundersRewardAddress": [ - "BanxgMPcMpXnuWQ2ogfQqEkwwVtjhAhXBR" - ], + "foundersRewardAddress": ["BanxgMPcMpXnuWQ2ogfQqEkwwVtjhAhXBR"], "shareMultiplier": 65536, "explorerBlockLink": "https://explorer.bitoreum.org/block/$hash$", "explorerTxLink": "https://explorer.bitoreum.org/tx/{0}", @@ -2296,10 +2183,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2314,10 +2198,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2387,9 +2268,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "sha256d" - ], + "blockTemplateRpcExtraParams": ["sha256d"], "explorerBlockLink": "https://chainz.cryptoid.info/smly/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/smly/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/smly/address.dws?{0}.htm" @@ -2409,10 +2288,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2422,9 +2298,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "scrypt" - ], + "blockTemplateRpcExtraParams": ["scrypt"], "shareMultiplier": 65536, "explorerBlockLink": "https://chainz.cryptoid.info/smly/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/smly/tx.dws?{0}.htm", @@ -2454,9 +2328,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "skein" - ], + "blockTemplateRpcExtraParams": ["skein"], "explorerBlockLink": "https://chainz.cryptoid.info/smly/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/smly/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/smly/address.dws?{0}.htm" @@ -2485,9 +2357,7 @@ } ] }, - "blockTemplateRpcExtraParams": [ - "qubit" - ], + "blockTemplateRpcExtraParams": ["qubit"], "explorerBlockLink": "https://chainz.cryptoid.info/smly/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/smly/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/smly/address.dws?{0}.htm" @@ -2517,9 +2387,7 @@ ] }, "shareMultiplier": 4096, - "blockTemplateRpcExtraParams": [ - "groestl" - ], + "blockTemplateRpcExtraParams": ["groestl"], "explorerBlockLink": "https://chainz.cryptoid.info/smly/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/smly/tx.dws?{0}.htm", "explorerAccountLink": "https://chainz.cryptoid.info/smly/address.dws?{0}.htm" @@ -2539,18 +2407,14 @@ }, "headerHasher": { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] }, "blockHasher": { "hash": "reverse", "args": [ { "hash": "neoscrypt", - "args": [ - 0 - ] + "args": [0] } ] }, @@ -2714,10 +2578,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2732,10 +2593,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2818,10 +2676,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2880,10 +2735,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -2898,10 +2750,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -2932,17 +2781,12 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, "isPseudoPoS": true, - "blockTemplateRpcExtraParams": [ - "lyra" - ], + "blockTemplateRpcExtraParams": ["lyra"], "shareMultiplier": 256, "explorerBlockLink": "https://verge-blockchain.info/block/$hash$", "explorerTxLink": "https://verge-blockchain.info/tx/{0}", @@ -2963,27 +2807,19 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, "isPseudoPoS": true, - "blockTemplateRpcExtraParams": [ - "scrypt" - ], + "blockTemplateRpcExtraParams": ["scrypt"], "shareMultiplier": 65536, "explorerBlockLink": "https://verge-blockchain.info/block/$hash$", "explorerTxLink": "https://verge-blockchain.info/tx/{0}", @@ -3010,17 +2846,12 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, "isPseudoPoS": true, - "blockTemplateRpcExtraParams": [ - "x17" - ], + "blockTemplateRpcExtraParams": ["x17"], "explorerBlockLink": "https://verge-blockchain.info/block/$hash$", "explorerTxLink": "https://verge-blockchain.info/tx/{0}", "explorerAccountLink": "https://verge-blockchain.info/address/{0}" @@ -3046,17 +2877,12 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, "isPseudoPoS": true, - "blockTemplateRpcExtraParams": [ - "blake" - ], + "blockTemplateRpcExtraParams": ["blake"], "explorerBlockLink": "https://verge-blockchain.info/block/$hash$", "explorerTxLink": "https://verge-blockchain.info/tx/{0}", "explorerAccountLink": "https://verge-blockchain.info/address/{0}" @@ -3082,17 +2908,12 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, "isPseudoPoS": true, - "blockTemplateRpcExtraParams": [ - "groestl" - ], + "blockTemplateRpcExtraParams": ["groestl"], "explorerBlockLink": "https://verge-blockchain.info/block/$hash$", "explorerTxLink": "https://verge-blockchain.info/tx/{0}", "explorerAccountLink": "https://verge-blockchain.info/address/{0}" @@ -3140,10 +2961,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -3158,10 +2976,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -3185,10 +3000,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -3203,10 +3015,7 @@ "args": [ { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] } ] }, @@ -3258,10 +3067,7 @@ }, "headerHasher": { "hash": "scrypt", - "args": [ - 1024, - 1 - ] + "args": [1024, 1] }, "blockHasher": { "hash": "reverse", @@ -3410,11 +3216,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3425,11 +3227,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3440,11 +3238,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3473,11 +3267,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3488,11 +3278,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3503,11 +3289,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BgoldPoW" - ] + "args": [144, 5, "BgoldPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3535,11 +3317,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3550,11 +3328,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3565,11 +3339,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3597,11 +3367,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BethdPoW" - ] + "args": [144, 5, "BethdPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3612,11 +3378,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BethdPoW" - ] + "args": [144, 5, "BethdPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3627,11 +3389,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 144, - 5, - "BethdPoW" - ] + "args": [144, 5, "BethdPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3659,11 +3417,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 96, - 5, - "ZcashPoW" - ] + "args": [96, 5, "ZcashPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3674,11 +3428,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 96, - 5, - "ZcashPoW" - ] + "args": [96, 5, "ZcashPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3689,11 +3439,7 @@ "solutionPreambleSize": 1, "solver": { "hash": "equihash", - "args": [ - 96, - 5, - "ZcashPoW" - ] + "args": [96, 5, "ZcashPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3721,11 +3467,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "Verushash" - ] + "args": [200, 9, "Verushash"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false, @@ -3742,11 +3484,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "Verushash" - ] + "args": [200, 9, "Verushash"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -3757,11 +3495,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "Verushash" - ] + "args": [200, 9, "Verushash"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -3789,11 +3523,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "zcash-main", "payFoundersReward": true, @@ -3864,11 +3594,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "zcash-test", "payFoundersReward": true, @@ -3939,11 +3665,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "zcash-reg", "payFoundersReward": true, @@ -3976,11 +3698,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": false @@ -3991,11 +3709,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": false @@ -4006,11 +3720,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": false @@ -4038,11 +3748,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "main", "payFoundersReward": true, @@ -4115,11 +3821,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "testnet", "payFoundersReward": true, @@ -4192,11 +3894,7 @@ "solutionPreambleSize": 3, "solver": { "hash": "equihash", - "args": [ - 200, - 9, - "ZcashPoW" - ] + "args": [200, 9, "ZcashPoW"] }, "coinbaseTxNetwork": "regtest", "payFoundersReward": true, @@ -4244,7 +3942,7 @@ "explorerBlockLink": "https://www.exploremonero.com/block/$height$", "explorerTxLink": "https://www.exploremonero.com/transaction/{0}" }, - "conceal": { + "conceal": { "name": "Conceal", "canonicalName": "Conceal", "symbol": "CCX", From 0ce7f70bb8b36bb4ea29253e375a67aecf339c70 Mon Sep 17 00:00:00 2001 From: jon4hz Date: Wed, 1 Feb 2023 15:56:02 +0100 Subject: [PATCH 2/6] feat: add support for mweb --- .../Blockchain/Bitcoin/BitcoinJobManager.cs | 17 +++++++++++++++-- .../Blockchain/Bitcoin/BitcoinJobManagerBase.cs | 16 ++++++++-------- .../Blockchain/Bitcoin/DaemonResponses/Mweb.cs | 8 ++++++++ src/Miningcore/Configuration/ClusterConfig.cs | 11 +++++++---- src/Miningcore/coins.json | 2 +- 5 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs index b8df94e37..1f1fa43cd 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs @@ -33,12 +33,17 @@ protected override object[] GetBlockTemplateParams() { var result = base.GetBlockTemplateParams(); + if(coin.HasMWEB) + { + result = result.Concat(new object[] { "mweb" }).ToArray(); + } + if(coin.BlockTemplateRpcExtraParams != null) { if(coin.BlockTemplateRpcExtraParams.Type == JTokenType.Array) result = result.Concat(coin.BlockTemplateRpcExtraParams.ToObject() ?? Array.Empty()).ToArray(); else - result = result.Concat(new []{ coin.BlockTemplateRpcExtraParams.ToObject()}).ToArray(); + result = result.Concat(new[] { coin.BlockTemplateRpcExtraParams.ToObject() }).ToArray(); } return result; @@ -71,7 +76,7 @@ protected override void PostChainIdentifyConfigure() if(poolConfig.EnableInternalStratum == true && coin.HeaderHasherValue is IHashAlgorithmInit hashInit) { if(!hashInit.DigestInit(poolConfig)) - logger.Error(()=> $"{hashInit.GetType().Name} initialization failed"); + logger.Error(() => $"{hashInit.GetType().Name} initialization failed"); } } @@ -254,6 +259,14 @@ public virtual async ValueTask SubmitShareAsync(StratumConnection worker, { logger.Info(() => $"Submitting block {share.BlockHeight} [{share.BlockHash}]"); + // if pool supports MWEB, we have to adjust the block hex + // https://github.com/litecoin-project/litecoin/blob/0.21/doc/mweb/mining-changes.md + if(coin.HasMWEB) + { + var mweb = job.BlockTemplate.Extra.SafeExtensionDataAs(); + blockHex = blockHex + "1" + mweb.Mweb; + } + var acceptResponse = await SubmitBlockAsync(share, blockHex, ct); // is it still a block candidate? diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs index e48a86d5e..0fc25bdc4 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs @@ -262,7 +262,7 @@ protected async Task SubmitBlockAsync(Share share, string blockHex ? new RpcRequest(BitcoinCommands.SubmitBlock, new[] { blockHex }) : new RpcRequest(BitcoinCommands.GetBlockTemplate, new { mode = "submit", data = blockHex }); - var batch = new [] + var batch = new[] { submitBlockRequest, new RpcRequest(BitcoinCommands.GetBlock, new[] { share.BlockHash }) @@ -466,17 +466,17 @@ protected override async Task PostStartInitAsync(CancellationToken ct) PostChainIdentifyConfigure(); // ensure pool owns wallet - if(validateAddressResponse is not {IsValid: true}) + if(validateAddressResponse is not { IsValid: true }) throw new PoolStartupException($"Daemon reports pool-address '{poolConfig.Address}' as invalid", poolConfig.Id); - isPoS = poolConfig.Template is BitcoinTemplate {IsPseudoPoS: true} || + isPoS = poolConfig.Template is BitcoinTemplate { IsPseudoPoS: true } || (difficultyResponse.Values().Any(x => x.Path == "proof-of-stake" && !difficultyResponse.Values().Any(x => x.Path == "proof-of-work"))); // Create pool address script from response if(!isPoS) { if(extraPoolConfig != null && extraPoolConfig.AddressType != BitcoinAddressType.Legacy) - logger.Info(()=> $"Interpreting pool address {poolConfig.Address} as type {extraPoolConfig?.AddressType.ToString()}"); + logger.Info(() => $"Interpreting pool address {poolConfig.Address} as type {extraPoolConfig?.AddressType.ToString()}"); poolAddressDestination = AddressToDestination(poolConfig.Address, extraPoolConfig?.AddressType); } @@ -488,8 +488,8 @@ protected override async Task PostStartInitAsync(CancellationToken ct) if(clusterConfig.PaymentProcessing?.Enabled == true && poolConfig.PaymentProcessing?.Enabled == true) { // ensure pool owns wallet - if(validateAddressResponse is {IsMine: false} && addressInfoResponse is {IsMine: false}) - logger.Warn(()=> $"Daemon does not own pool-address '{poolConfig.Address}'"); + if(validateAddressResponse is { IsMine: false } && addressInfoResponse is { IsMine: false }) + logger.Warn(() => $"Daemon does not own pool-address '{poolConfig.Address}'"); } // update stats @@ -512,7 +512,7 @@ protected override async Task PostStartInitAsync(CancellationToken ct) // Periodically update network stats Observable.Interval(TimeSpan.FromMinutes(10)) .Select(_ => Observable.FromAsync(() => - Guard(()=> !hasLegacyDaemon ? UpdateNetworkStatsAsync(ct) : UpdateNetworkStatsLegacyAsync(ct), + Guard(() => !hasLegacyDaemon ? UpdateNetworkStatsAsync(ct) : UpdateNetworkStatsLegacyAsync(ct), ex => logger.Error(ex)))) .Concat() .Subscribe(); @@ -573,7 +573,7 @@ public virtual async Task ValidateAddressAsync(string address, Cancellatio var result = await rpc.ExecuteAsync(logger, BitcoinCommands.ValidateAddress, ct, new[] { address }); - return result.Response is {IsValid: true}; + return result.Response is { IsValid: true }; } #endregion // API-Surface diff --git a/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs b/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs new file mode 100644 index 000000000..668563712 --- /dev/null +++ b/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs @@ -0,0 +1,8 @@ +using Newtonsoft.Json; + +namespace Miningcore.Blockchain.Bitcoin.DaemonResponses; + +public class MwebBlockTemplateExtra +{ + public string Mweb { get; set; } +} diff --git a/src/Miningcore/Configuration/ClusterConfig.cs b/src/Miningcore/Configuration/ClusterConfig.cs index 9392d47b4..1854a7efa 100644 --- a/src/Miningcore/Configuration/ClusterConfig.cs +++ b/src/Miningcore/Configuration/ClusterConfig.cs @@ -24,7 +24,7 @@ public enum CoinFamily [EnumMember(Value = "conceal")] Conceal, - + [EnumMember(Value = "cryptonote")] Cryptonote, @@ -214,6 +214,9 @@ public class BitcoinNetworkParams [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public JToken BlockTemplateRpcExtraParams { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool HasMWEB { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public Dictionary Networks { get; set; } @@ -438,13 +441,13 @@ public partial class ConcealCoinTemplate : CoinTemplate /// [JsonProperty(Order = -4, DefaultValueHandling = DefaultValueHandling.Include)] public int HashVariant { get; set; } - + /// /// Conceal network hashrate = `Difficulty / DifficultyTarget` /// See: parameter -> DIFFICULTY_TARGET in src/CryptoNoteConfig.h /// public ulong DifficultyTarget { get; set; } - + /// /// Smallest unit for Blockreward formatting /// @@ -830,7 +833,7 @@ public partial class ClusterPaymentProcessingConfig /// /// Indentifier used in coinbase transactions to identify the pool /// - public string CoinbaseString { get; set; } + public string CoinbaseString { get; set; } } public partial class PersistenceConfig diff --git a/src/Miningcore/coins.json b/src/Miningcore/coins.json index 40c986f51..1c5a862a9 100644 --- a/src/Miningcore/coins.json +++ b/src/Miningcore/coins.json @@ -1464,7 +1464,7 @@ } ] }, - "blockTemplateRpcExtraParams": ["mweb"], + "hasMWEB": true, "shareMultiplier": 65536, "explorerBlockLink": "https://chainz.cryptoid.info/ltc/block.dws?$height$.htm", "explorerTxLink": "https://chainz.cryptoid.info/ltc/tx.dws?{0}.htm", From 1b4db9a4a691dc08f272b95b02d4527bdb42a7dd Mon Sep 17 00:00:00 2001 From: jon4hz Date: Wed, 1 Feb 2023 19:15:12 +0100 Subject: [PATCH 3/6] fix: getblocktemplate for ltc --- .../Blockchain/Bitcoin/BitcoinJobManager.cs | 42 ++++++++++++++++++- .../Bitcoin/BitcoinJobManagerBase.cs | 7 +++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs index 1f1fa43cd..ccf846769 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; @@ -35,7 +36,13 @@ protected override object[] GetBlockTemplateParams() if(coin.HasMWEB) { - result = result.Concat(new object[] { "mweb" }).ToArray(); + result = new object[] + { + new + { + rules = new[] {"segwit", "mweb"}, + } + }; } if(coin.BlockTemplateRpcExtraParams != null) @@ -49,6 +56,39 @@ protected override object[] GetBlockTemplateParams() return result; } + protected override async Task EnsureDaemonsSynchedAsync(CancellationToken ct) + { + using var timer = new PeriodicTimer(TimeSpan.FromSeconds(5)); + + var syncPendingNotificationShown = false; + + do + { + var response = await rpc.ExecuteAsync(logger, + BitcoinCommands.GetBlockTemplate, ct, GetBlockTemplateParams()); + + var isSynched = response.Error == null; + + if(isSynched) + { + logger.Info(() => "All daemons synched with blockchain"); + break; + } + else + { + logger.Debug(() => $"Daemon reports error: {response.Error?.Message}"); + } + + if(!syncPendingNotificationShown) + { + logger.Info(() => "Daemon is still syncing with network. Manager will be started once synced."); + syncPendingNotificationShown = true; + } + + await ShowDaemonSyncProgressAsync(ct); + } while(await timer.WaitForNextTickAsync(ct)); + } + protected async Task> GetBlockTemplateAsync(CancellationToken ct) { var result = await rpc.ExecuteAsync(logger, diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs index 0fc25bdc4..5a268527e 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs @@ -381,7 +381,12 @@ protected override async Task AreDaemonsHealthyAsync(CancellationToken ct) var response = await rpc.ExecuteAsync(logger, BitcoinCommands.GetBlockchainInfo, ct); - return response.Error == null; + if(response.Error != null) + { + logger.Error(() => $"Daemon reports: {response.Error.Message}"); + return false; + } + return true; } protected override async Task AreDaemonsConnectedAsync(CancellationToken ct) From 3ad4f8887a6e14b301c28b809ac97a7ba49d4dd8 Mon Sep 17 00:00:00 2001 From: jon4hz Date: Sun, 5 Feb 2023 23:58:29 +0100 Subject: [PATCH 4/6] fix: hex 01 --- src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs index ccf846769..418537cba 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs @@ -304,7 +304,7 @@ public virtual async ValueTask SubmitShareAsync(StratumConnection worker, if(coin.HasMWEB) { var mweb = job.BlockTemplate.Extra.SafeExtensionDataAs(); - blockHex = blockHex + "1" + mweb.Mweb; + blockHex = blockHex + "01" + mweb.Mweb; } var acceptResponse = await SubmitBlockAsync(share, blockHex, ct); From 4d203849eee11f2a2ddd2cc484b4c6cfe80665c6 Mon Sep 17 00:00:00 2001 From: jon4hz Date: Mon, 6 Feb 2023 02:58:52 +0100 Subject: [PATCH 5/6] fix(litecoin): support for native segwit pool wallet --- examples/litecoin_dash_pool.json | 3 ++- examples/litecoin_pool.json | 3 ++- .../Blockchain/Bitcoin/BitcoinConstants.cs | 5 +++++ .../Blockchain/Bitcoin/BitcoinJobManagerBase.cs | 3 +++ src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs | 13 +++++++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/examples/litecoin_dash_pool.json b/examples/litecoin_dash_pool.json index 56d85f6cf..59ff2c628 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 b2482b257..72a801d41 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 0db3cd3bd..025403bdb 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/BitcoinJobManagerBase.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs index 5a268527e..a53282868 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs @@ -539,6 +539,9 @@ protected virtual IDestination AddressToDestination(string address, BitcoinAddre case BitcoinAddressType.BCash: return BitcoinUtils.BCashAddressToDestination(poolConfig.Address, network); + case BitcoinAddressType.Litecoin: + return BitcoinUtils.LitecoinAddressToDestination(poolConfig.Address, network); + default: return BitcoinUtils.AddressToDestination(poolConfig.Address, network); } diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs index ea9fa0dd7..faf447d5a 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs @@ -41,4 +41,17 @@ public static IDestination BCashAddressToDestination(string address, Network exp var trashAddress = bcash.Parse(address); return trashAddress.ScriptPubKey.GetDestinationAddress(bcash); } + + public static IDestination LitecoinAddressToDestination(string address, Network expectedNetwork) + { + var litecoin = NBitcoin.Altcoins.Litecoin.Instance.GetNetwork(expectedNetwork.ChainName); + var encoder = litecoin.GetBech32Encoder(Bech32Type.WITNESS_PUBKEY_ADDRESS, true); + + var decoded = encoder.Decode(address, out var witVersion); + var result = new WitKeyId(decoded); + + Debug.Assert(result.GetAddress(litecoin).ToString() == address); + return result; + } } + From 8c9423a6078a6d7a304325c4ec878e6235970208 Mon Sep 17 00:00:00 2001 From: jon4hz Date: Wed, 15 Feb 2023 03:21:23 +0100 Subject: [PATCH 6/6] fix: improve mweb data handling --- .../Blockchain/Bitcoin/BitcoinJob.cs | 26 ++++++++++++++----- .../Blockchain/Bitcoin/BitcoinJobManager.cs | 8 ------ .../Bitcoin/DaemonResponses/Mweb.cs | 2 -- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs b/src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs index 0557ac076..7bff0b6a2 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 418537cba..14675f451 100644 --- a/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs +++ b/src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs @@ -299,14 +299,6 @@ public virtual async ValueTask SubmitShareAsync(StratumConnection worker, { logger.Info(() => $"Submitting block {share.BlockHeight} [{share.BlockHash}]"); - // if pool supports MWEB, we have to adjust the block hex - // https://github.com/litecoin-project/litecoin/blob/0.21/doc/mweb/mining-changes.md - if(coin.HasMWEB) - { - var mweb = job.BlockTemplate.Extra.SafeExtensionDataAs(); - blockHex = blockHex + "01" + mweb.Mweb; - } - var acceptResponse = await SubmitBlockAsync(share, blockHex, ct); // is it still a block candidate? diff --git a/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs b/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs index 668563712..b5b2049fd 100644 --- a/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs +++ b/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Mweb.cs @@ -1,5 +1,3 @@ -using Newtonsoft.Json; - namespace Miningcore.Blockchain.Bitcoin.DaemonResponses; public class MwebBlockTemplateExtra