Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Dev (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Weichhold authored Oct 11, 2018
1 parent 2f1b117 commit ec14fba
Show file tree
Hide file tree
Showing 41 changed files with 243 additions and 283 deletions.
4 changes: 1 addition & 3 deletions examples/dash_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "dash1",
"enabled": true,
"coin": {
"type": "DASH"
},
"coin": "dash",
"address": "XgmfWd5DXWGcYhxPcDPUJk44Cnh2e8tZk7",
"rewardRecipients": [{
"address": "XgmfWd5DXWGcYhxPcDPUJk44Cnh2e8tZk7",
Expand Down
4 changes: 1 addition & 3 deletions examples/dash_pool_no_polling.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "dash1",
"enabled": true,
"coin": {
"type": "DASH"
},
"coin": "dash",
"address": "XgmfWd5DXWGcYhxPcDPUJk44Cnh2e8tZk7",
"rewardRecipients": [{
"address": "XgmfWd5DXWGcYhxPcDPUJk44Cnh2e8tZk7",
Expand Down
5 changes: 1 addition & 4 deletions examples/digibyte_scrypt_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
"pools": [{
"id": "dgb-scrypt-1",
"enabled": true,
"coin": {
"type": "DGB",
"algorithm": "scrypt"
},
"coin": "digibyte-scrypt",
"address": "DAFtYMGVdNtqHJoBGg2xqZZwSuYAaEs2Bn",
"rewardRecipients": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/digibyte_sha256_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
"pools": [{
"id": "dgb-sha256-1",
"enabled": true,
"coin": {
"type": "DGB",
"algorithm": "sha256d"
},
"coin": "digibyte-sha256",
"address": "DAFtYMGVdNtqHJoBGg2xqZZwSuYAaEs2Bn",
"rewardRecipients": [
{
Expand Down
4 changes: 1 addition & 3 deletions examples/ethereum_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "eth1",
"enabled": true,
"coin": {
"type": "ETH"
},
"coin": "ethereum",
"address": "0x0942e9144606ad43f2e61a7ee332fe9914424712",
"rewardRecipients": [{
"type": "op",
Expand Down
4 changes: 1 addition & 3 deletions examples/flo_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
{
"id": "flo1",
"enabled": true,
"coin": {
"type": "FLO"
},
"coin": "florincoin",
"address": "FC3d6JT1Z3uZvKVNWjKt3qN8PX8knhAU7d",
"rewardRecipients": [
{
Expand Down
8 changes: 2 additions & 6 deletions examples/litecoin_dash_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "ltc1",
"enabled": true,
"coin": {
"type": "LTC"
},
"coin": "litecoin",
"address": "LNDA11u4HWzbJaBGiHDvs6SmA8M6avB3wH",
"rewardRecipients": [{
"address": "LUWYwkz6DQLVeqJqHRtGjNhWUxBvBmE3SX",
Expand Down Expand Up @@ -93,9 +91,7 @@
{
"id": "dash1",
"enabled": true,
"coin": {
"type": "DASH"
},
"coin": "dash",
"address": "XgmfWd5DXWGcYhxPcDPUJk44Cnh2e8tZk7",
"rewardRecipients": [{
"type": "op",
Expand Down
4 changes: 1 addition & 3 deletions examples/litecoin_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "ltc1",
"enabled": true,
"coin": {
"type": "LTC"
},
"coin": "litecoin",
"address": "LNDA11u4HWzbJaBGiHDvs6SmA8M6avB3wH",
"rewardRecipients": [
{
Expand Down
4 changes: 1 addition & 3 deletions examples/monero_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"pools": [{
"id": "xmr1",
"enabled": true,
"coin": {
"type": "XMR"
},
"coin": "monero",
"address": "43g9avHw8WYHnq749LU1Nw1BZ8FCwS2B7GLoW4vif7cPjJB7e9f6WgU8ptDFM7kyNS9kz1zy334dAYFKgP2KJU8vMoZ3hYD",
"rewardRecipients": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/pakcoin_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
"pools": [{
"id": "pak1",
"enabled": true,
"coin": {
"type": "PAK",
"algorithm": "scrypt"
},
"coin": "pakcoin",
"hasLegacyDaemon": true,
"address": "PSWsdRBXui6nnhV9FJ4NduC2KdFkeudtEz",
"rewardRecipients": [
Expand Down
121 changes: 0 additions & 121 deletions examples/straks_pool.json

This file was deleted.

4 changes: 1 addition & 3 deletions examples/zcash_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
"pools": [{
"id": "zec1",
"enabled": true,
"coin": {
"type": "ZEC"
},
"coin": "zcash",
"address": "t1YHZHz2DGVMJiggD2P4fBQ2TAPgtLSUwZ7",
"z-address": "zca7tCyUqn6axyZTWfiFTufI28sJNOnC2p3PHV4txH1XdDGsAjw1AKM8qiHznMTSw5GXUbWqS7P7Qc1sDw93CQePCLuPXXr",
"rewardRecipients": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public void MoneroJob_Should_Accept_Valid_Share()
"{\"blocktemplate_blob\":\"0106e7eabdcf058234351e2e6ea901a56b33bb531587424321873072d80a9e97295b6c43152b9d00000000019c0201ffe00106e3a1a0cc010275d92c0a057aa5f073079694a153d426f837f49fdb9654da10a5364e79a2086280a0d9e61d028b46dca0d04998500b40b046fd6f8bb33229e6380fd465dbb1327aa6f813d8bd80c0fc82aa0202372f076459e769116d604d30aabff7160782acc0d20e0c5cdc8963ed4e16372f8090cad2c60e02f009504ce65538bbb684b466b21be3a90e3740f185d7089d37b75f0cf62b6e7680e08d84ddcb0102cf01b85c0b592bb6e508e20b5d317052b75de121908390363201abff3476ef0180c0caf384a302024b81076c8ad0cfe84cc32fe0813d63cdd0f7d8d0e56d82aa3f58cbbe49d4c61e2b017aaf3074be7ecb30a769595758e4da7c7c87ead864baf89b679b73153dfa352c0208000000000000000000\",\"Difficulty\":2,\"Height\":224,\"prev_hash\":\"8234351e2e6ea901a56b33bb531587424321873072d80a9e97295b6c43152b9d\",\"reserved_offset\":322,\"Status\":\"OK\"}");

var job = new CryptonoteJob(bt, "d150da".HexToByteArray(), "1", poolConfig, clusterConfig);
var (share, blobHex, blobHash) = job.ProcessShare("040100a4", 1, "f29c7fbf57d97eeedb61555857d7a34314250da20742b8157f96e0be89530a00", worker);
var (share, blobHex) = job.ProcessShare("040100a4", 1, "f29c7fbf57d97eeedb61555857d7a34314250da20742b8157f96e0be89530a00", worker);

Assert.NotNull(share);
Assert.True(share.IsBlockCandidate);
Assert.Equal(blobHash, "9258faf2dff5daf026681b5fa5d94a34dbb5bade1d9e2070865ba8c68f8f0454");
Assert.Equal(share.BlockHash, "9258faf2dff5daf026681b5fa5d94a34dbb5bade1d9e2070865ba8c68f8f0454");
Assert.Equal(blobHex, "0106e7eabdcf058234351e2e6ea901a56b33bb531587424321873072d80a9e97295b6c43152b9d040100a4019c0201ffe00106e3a1a0cc010275d92c0a057aa5f073079694a153d426f837f49fdb9654da10a5364e79a2086280a0d9e61d028b46dca0d04998500b40b046fd6f8bb33229e6380fd465dbb1327aa6f813d8bd80c0fc82aa0202372f076459e769116d604d30aabff7160782acc0d20e0c5cdc8963ed4e16372f8090cad2c60e02f009504ce65538bbb684b466b21be3a90e3740f185d7089d37b75f0cf62b6e7680e08d84ddcb0102cf01b85c0b592bb6e508e20b5d317052b75de121908390363201abff3476ef0180c0caf384a302024b81076c8ad0cfe84cc32fe0813d63cdd0f7d8d0e56d82aa3f58cbbe49d4c61e2b017aaf3074be7ecb30a769595758e4da7c7c87ead864baf89b679b73153dfa352c02080000000001d150da00");
Assert.Equal(share.BlockHeight, 224);
Assert.Equal(share.Difficulty, 1000);
Expand Down
27 changes: 14 additions & 13 deletions src/Miningcore.Tests/Crypto/CrytonoteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using Miningcore.Extensions;
using Miningcore.Native;
using Xunit;

using static Miningcore.Native.LibCryptonight;

namespace Miningcore.Tests.Crypto
{
public class CrytonoteTests : TestBase
Expand All @@ -13,13 +14,13 @@ public void Crytonight()
var blobConverted = "0106a2aaafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42580100a4b1e2f4baf6ab7109071ab59bc52dba740d1de99fa0ae0c4afd6ea9f40c5d87ec01".HexToByteArray();
var buf = new byte[32];

LibCryptonight.Cryptonight(blobConverted, buf, 0);
LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_0);
var result = buf.ToHexString();
Assert.Equal("a845ffbdf83ae9a8ffa504a1011efbd5ed2294bb9da591d3b583740568402c00", result);

Array.Clear(buf,0, buf.Length);

LibCryptonight.Cryptonight(blobConverted, buf, 0);
LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_0);
result = buf.ToHexString();
Assert.Equal("a845ffbdf83ae9a8ffa504a1011efbd5ed2294bb9da591d3b583740568402c00", result);
}
Expand All @@ -30,13 +31,13 @@ public void Crytonight_Variant_1()
var blobConverted = "0106a2aaafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42580100a4b1e2f4baf6ab7109071ab59bc52dba740d1de99fa0ae0c4afd6ea9f40c5d87ec01".HexToByteArray();
var buf = new byte[32];

LibCryptonight.Cryptonight(blobConverted, buf, 1);
LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_1);
var result = buf.ToHexString();
Assert.Equal("c41ec6434df8b2307ff3105ae15206f3fbdf5a99b35879c0a27b8b85a8e2704f", result);

Array.Clear(buf, 0, buf.Length);

LibCryptonight.Cryptonight(blobConverted, buf, 1);
LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_1);
result = buf.ToHexString();
Assert.Equal("c41ec6434df8b2307ff3105ae15206f3fbdf5a99b35879c0a27b8b85a8e2704f", result);
}
Expand All @@ -58,13 +59,13 @@ public void Crytonight_Light()
var blobConverted = "0106f1adafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42597710c48c6d885e2622f40f82ecd9b9fd538f28df9b0557e07cd3237a31c76569ada98001".HexToByteArray();
var buf = new byte[32];

LibCryptonight.CryptonightLight(blobConverted, buf, 0);
LibCryptonight.CryptonightLight(blobConverted, buf, CryptonightVariant.VARIANT_0);
var result = buf.ToHexString();
Assert.Equal("0769caee428a232cffb76fa200f174ff962734f24e7b3bf8d1b0d4e8ba6ceebf", result);

Array.Clear(buf, 0, buf.Length);

LibCryptonight.CryptonightLight(blobConverted, buf, 0);
LibCryptonight.CryptonightLight(blobConverted, buf, CryptonightVariant.VARIANT_0);
result = buf.ToHexString();
Assert.Equal("0769caee428a232cffb76fa200f174ff962734f24e7b3bf8d1b0d4e8ba6ceebf", result);
}
Expand All @@ -75,13 +76,13 @@ public void Crytonight_Light_Variant_1()
var blobConverted = "0106f1adafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42597710c48c6d885e2622f40f82ecd9b9fd538f28df9b0557e07cd3237a31c76569ada98001".HexToByteArray();
var buf = new byte[32];

LibCryptonight.CryptonightLight(blobConverted, buf, 0);
LibCryptonight.CryptonightLight(blobConverted, buf, CryptonightVariant.VARIANT_0);
var result = buf.ToHexString();
Assert.Equal("0769caee428a232cffb76fa200f174ff962734f24e7b3bf8d1b0d4e8ba6ceebf", result);

Array.Clear(buf, 0, buf.Length);

LibCryptonight.CryptonightLight(blobConverted, buf, 0);
LibCryptonight.CryptonightLight(blobConverted, buf, CryptonightVariant.VARIANT_0);
result = buf.ToHexString();
Assert.Equal("0769caee428a232cffb76fa200f174ff962734f24e7b3bf8d1b0d4e8ba6ceebf", result);
}
Expand All @@ -92,13 +93,13 @@ public void Crytonight_Heavy()
var blobConverted = "0106f1adafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42597710c48c6d885e2622f40f82ecd9b9fd538f28df9b0557e07cd3237a31c76569ada98001".HexToByteArray();
var buf = new byte[32];

LibCryptonight.CryptonightHeavy(blobConverted, buf, 0);
LibCryptonight.CryptonightHeavy(blobConverted, buf, CryptonightVariant.VARIANT_0);
var result = buf.ToHexString();
Assert.Equal("1559665f933c0aab5bf2b11db406b9db170a78d82d180ee5a7cf88f1c2041f9e", result);

Array.Clear(buf, 0, buf.Length);

LibCryptonight.CryptonightHeavy(blobConverted, buf, 0);
LibCryptonight.CryptonightHeavy(blobConverted, buf, CryptonightVariant.VARIANT_0);
result = buf.ToHexString();
Assert.Equal("1559665f933c0aab5bf2b11db406b9db170a78d82d180ee5a7cf88f1c2041f9e", result);
}
Expand All @@ -109,13 +110,13 @@ public void Crytonight_Heavy_Variant_1()
var blobConverted = "0106f1adafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42597710c48c6d885e2622f40f82ecd9b9fd538f28df9b0557e07cd3237a31c76569ada98001".HexToByteArray();
var buf = new byte[32];

LibCryptonight.CryptonightHeavy(blobConverted, buf, 1);
LibCryptonight.CryptonightHeavy(blobConverted, buf, CryptonightVariant.VARIANT_1);
var result = buf.ToHexString();
Assert.Equal("342418ec4bf806aafb102b34d64fc33ab91d89ad40786b92d1b54ceeb4d50822", result);

Array.Clear(buf, 0, buf.Length);

LibCryptonight.CryptonightHeavy(blobConverted, buf, 1);
LibCryptonight.CryptonightHeavy(blobConverted, buf, CryptonightVariant.VARIANT_1);
result = buf.ToHexString();
Assert.Equal("342418ec4bf806aafb102b34d64fc33ab91d89ad40786b92d1b54ceeb4d50822", result);
}
Expand Down
1 change: 1 addition & 0 deletions src/Miningcore/Api/Responses/GetPoolsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Miningcore.Api.Responses
public class ApiCoinConfig
{
public string Type { get; set; }
public string Name { get; set; }
public string Algorithm { get; set; }
}

Expand Down
4 changes: 2 additions & 2 deletions src/Miningcore/Blockchain/Bitcoin/BitcoinPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ protected virtual async Task OnAuthorizeAsync(StratumClient client, Timestamped<

// assumes that workerName is an address
context.IsAuthorized = !string.IsNullOrEmpty(minerName) && await manager.ValidateAddressAsync(minerName, ct);
context.MinerName = minerName;
context.WorkerName = workerName;
context.Miner = minerName;
context.Worker = workerName;

if (context.IsAuthorized)
{
Expand Down
Loading

0 comments on commit ec14fba

Please sign in to comment.