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

Dev #595

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
6983727
Reduce re-connect wait time
Nov 4, 2018
758518a
Mini Refactor
Nov 4, 2018
3536a02
Eliminate Bitcoin blockreward multiplier and update actual blockrewar…
Nov 4, 2018
401b031
Update blockreward during unlock stage
Nov 4, 2018
8fd5dab
Explorer links
Nov 5, 2018
1096ee4
More logging
Nov 5, 2018
0f78a96
Conversion fix
Nov 5, 2018
5fa11cd
Fixes #457
Nov 5, 2018
6896dda
Restore formatted JSON API responses
Nov 5, 2018
6f9a8e3
Fixes #428
Nov 5, 2018
ec6d50a
WIP
Nov 5, 2018
11c607b
Log tx key
Nov 5, 2018
db7c68f
Version-Rolling logging
Nov 5, 2018
8970205
Revert "Fixes #428"
Nov 6, 2018
9352f4d
Payout by ordered balance
Nov 6, 2018
ee28eb6
sv/gamma fix
Nov 6, 2018
a8c961f
Always set blockreward to zero if orphaned
Nov 6, 2018
12f0b75
Do not set blockreward until confirmed
Nov 6, 2018
993fc8c
Eliminate BlockrewardMultiplier
Nov 6, 2018
efa2067
Log current balance
Nov 6, 2018
ea3a171
Alternative way to detect network hashrate for bitcoin
Nov 6, 2018
43840d1
Fix tests
Nov 6, 2018
88d7e4d
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Nov 6, 2018
cc34e91
Dispose SslStream
Nov 6, 2018
5033b33
Mini-refactor
Nov 6, 2018
4d72284
Log bitcoin family shares with actual stratum diff
Nov 6, 2018
d1c549f
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Nov 7, 2018
86c820a
Per-relay reconnect on timeout
Nov 7, 2018
7363f09
Cleanup
Nov 7, 2018
8fa63ff
sslstream disposing was still not 100% ensured
Nov 7, 2018
4ad951d
Don't check notification enable status on publisher side!
Nov 7, 2018
73680f1
More compact implementation of BtStreamReceiver receiver logic includ…
Nov 7, 2018
13ccc05
Merge branch 'dev' of https://github.com/coinfoundry/miningcore into dev
Nov 7, 2018
a64a891
Disable hashrate modifier
Nov 8, 2018
366b930
WIP
Nov 8, 2018
f9d9d9c
Use ValueTask in some hotspots that mostly complete synchronously
Nov 8, 2018
c688f42
PAC
Nov 8, 2018
1b86771
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Nov 9, 2018
c9f9b7e
Scrap HashrateMultiplier
Nov 9, 2018
dde77d7
Florincoin -> Flo (#465)
bitspill Nov 9, 2018
9b8a3cf
Revert FLO explorer links (for now)
Nov 9, 2018
fc3a9d2
Capitalize FLO
Nov 9, 2018
5fd8d4c
WIP
Nov 9, 2018
144d3fd
Config overridable coinbase tx comments
Nov 9, 2018
ea56781
Update flo explorer links to new domain but leave as http
Nov 10, 2018
2beeb2a
Improved http connection pooling
Nov 10, 2018
81d5650
MessageBusExtensions
Nov 10, 2018
f973c12
.gitignore
Nov 10, 2018
e617ab0
Revert "Improved http connection pooling" and improved implementation
Nov 11, 2018
bb81182
Refactor
Nov 11, 2018
6263dfd
Hashrate updated notification
Nov 11, 2018
bc49145
More block notification properties
Nov 11, 2018
3162839
Emit HashrateNotification for miner's total hashrate
Nov 12, 2018
7fbf718
WIP
Nov 12, 2018
916710e
Publish block effort
Nov 12, 2018
1f6cb48
Merge branch 'dev' of https://github.com/coinfoundry/miningcore into dev
Nov 12, 2018
fa76f38
Camelcase enum serialization
Nov 13, 2018
42543fd
Don't clear validJobs on new blocks, causing lots of rejects
Nov 13, 2018
3fc7a8a
Implement support for mining.extranonce.subscribe
Nov 13, 2018
895723d
Also update extranonce if client subscribed for updates and submitted…
Nov 13, 2018
cdc6218
Update range
Nov 13, 2018
e07c972
WIP
Nov 13, 2018
efafcf4
Fix rounding problems with Bitcoin Core 0.17
Nov 13, 2018
3722950
Revert "Implement support for mining.extranonce.subscribe"
Nov 13, 2018
5eb2322
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Nov 14, 2018
3a66a9f
Merge branch 'dev' of https://github.com/coinfoundry/miningcore into dev
Nov 14, 2018
73b6aa5
Dash v13 changes
Nov 14, 2018
31fad67
BTH test
Nov 14, 2018
6ed0ce2
Enhance pool/blocks API with block state parameter support
Nov 14, 2018
f624db4
Cluster API controller
Nov 14, 2018
fc4ba36
Don't return blocks for disabled pools.
Nov 14, 2018
0fd0c20
WIP
Nov 14, 2018
23736c2
WIP
Nov 14, 2018
585c16e
Block Id in API responses
Nov 15, 2018
5614c42
Revert "Block Id in API responses"
Nov 16, 2018
9629f43
ETH logging
Nov 18, 2018
8ffced9
Setup
Nov 19, 2018
8ba198a
WIP
Nov 19, 2018
f70c896
Pool pubkey support for POS contains (if daemon does not have wallet …
Nov 19, 2018
8875f47
x22i hash
Nov 19, 2018
8449d5f
Merge branch 'dev' of https://github.com/coinfoundry/miningcore into dev
Nov 19, 2018
74bed0b
Revert "x22i hash"
Nov 20, 2018
00d1171
WIP
Nov 20, 2018
f74809d
x22i proper
Nov 21, 2018
69a1eb8
Payee support
Nov 22, 2018
81a346b
Ban on SSL handshake error
Nov 23, 2018
cc22cae
WIP
Nov 23, 2018
3b6e230
WIP
Nov 23, 2018
e9a131d
Merge branch 'master' of https://github.com/coinfoundry/Miningcore in…
Nov 23, 2018
b6ea4d6
nuget update
Nov 23, 2018
419fafd
Added some prometheus metrics
Nov 23, 2018
bf4b5a2
Metrics refactor
Nov 23, 2018
570afc7
Improve API IP access whitelist handling
Nov 23, 2018
3efa188
WIP
Nov 23, 2018
1a620a1
Merge branch 'dev' of https://github.com/coinfoundry/miningcore into dev
Nov 23, 2018
ebee2a9
WIP
Nov 23, 2018
1777d6e
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Nov 26, 2018
400c25b
Threads -> Tasks
Nov 28, 2018
dabcd77
Refactor
Nov 28, 2018
613a022
Merge branch 'master' of https://github.com/coinfoundry/Miningcore in…
Nov 28, 2018
2dc2a87
x21s hash
Dec 1, 2018
470239a
Build fix
Dec 1, 2018
29c8d2a
WIP
Dec 6, 2018
0330743
WIP
Dec 6, 2018
ef787e3
Upgrade to Net Core 2.2
Jan 29, 2019
97cc2ce
README.md
Jan 29, 2019
47ab0e6
Lyra3 support
Jan 29, 2019
1f58f37
Fix linux-build.sh
Jan 29, 2019
db36d36
Update Vertcoin for Lyra3 Hardfork
Jan 29, 2019
ec10a58
Cryptonight CNv4 (aka CryptonightR) support for upcoming Monero hard …
Feb 25, 2019
d16e085
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Feb 25, 2019
236bf53
Refactor
Feb 25, 2019
7ca8da9
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Feb 25, 2019
d71bc5d
Merge branch 'master' of https://github.com/coinfoundry/miningcore in…
Feb 26, 2019
ad60fff
Fix rate limit stuff
Mar 2, 2019
0f55c03
Cleanup
Mar 2, 2019
81b343d
Readonly span
Mar 2, 2019
2dbad70
Fixes #526
Mar 2, 2019
58f3310
Sync Cryptonight with upstream
Mar 8, 2019
eb39792
Fix appveyor builds
Apr 4, 2019
98350f1
Bump NLog from 4.5.11 to 4.6.1 in /src/Miningcore (#593)
dependabot[bot] Apr 4, 2019
501f2c1
Bump prometheus-net from 3.0.3 to 3.1.0 in /src/Miningcore (#592)
dependabot[bot] Apr 4, 2019
8a5625a
Bump NBitcoin from 4.1.1.82 to 4.1.1.96 in /src/Miningcore (#591)
dependabot[bot] Apr 4, 2019
990f58f
Bump FluentValidation from 8.1.3 to 8.2.0 in /src/Miningcore (#590)
dependabot[bot] Apr 4, 2019
fe719c3
Bump FluentValidation.ValidatorAttribute in /src/Miningcore (#589)
dependabot[bot] Apr 4, 2019
9b832e7
Bump Autofac from 4.9.1 to 4.9.2 in /src/Miningcore (#583)
dependabot[bot] Apr 4, 2019
dd84744
Bump McMaster.Extensions.CommandLineUtils in /src/Miningcore (#580)
dependabot[bot] Apr 4, 2019
cea10d1
Bump AspNetCoreRateLimit from 3.0.2 to 3.0.3 in /src/Miningcore (#579)
dependabot[bot] Apr 4, 2019
46361d3
Bump Polly from 7.0.3 to 7.1.0 in /src/Miningcore (#578)
dependabot[bot] Apr 4, 2019
727fa6b
Bump prometheus-net.AspNetCore from 3.0.3 to 3.1.0 in /src/Miningcore…
dependabot[bot] Apr 4, 2019
3479587
Bump JetBrains.Annotations from 2018.3.0 to 2019.1.1 in /src/Miningco…
dependabot[bot] Apr 4, 2019
82d8dbd
Bump Dapper from 1.50.7 to 1.60.6 in /src/Miningcore (#586)
dependabot[bot] Apr 4, 2019
31a583b
.editorconfig
Apr 4, 2019
82d5728
Move editorconfig
Apr 4, 2019
7f2e7ba
Formatting pass
Apr 4, 2019
a7c5559
Relocate .editorconfig again
Apr 4, 2019
bf73759
Add .editorconfig to solution
Apr 4, 2019
e4a8d9e
Bump NBitcoin from 4.1.1.96 to 4.1.1.97 in /src/Miningcore (#594)
dependabot[bot] Apr 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ build_script:
- sh: sudo apt-get update -y && sudo apt-get -y install cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
- # Publish
- cd Miningcore
- dotnet publish -c Release --framework netcoreapp2.1
- dotnet publish -c Release --framework netcoreapp2.2
- # Publish Artifacts
- sh: (cd bin/Release/netcoreapp2.1 && mkdir miningcore && cp -r publish/* miningcore && tar cf miningcore-linux-ubuntu-x64.tar.gz miningcore && appveyor PushArtifact miningcore-linux-ubuntu-x64.tar.gz)
- cmd: cd bin\Release\netcoreapp2.1 && mkdir miningcore && xcopy publish\* miningcore /S && 7z a miningcore-win-x64.zip miningcore && appveyor PushArtifact miningcore-win-x64.zip && cd ..\..\..
- sh: (cd bin/Release/netcoreapp2.2 && mkdir miningcore && cp -r publish/* miningcore && tar cf miningcore-linux-ubuntu-x64.tar.gz miningcore && appveyor PushArtifact miningcore-linux-ubuntu-x64.tar.gz)
- cmd: cd bin\Release\netcoreapp2.2 && mkdir miningcore && xcopy publish\* miningcore /S && 7z a miningcore-win-x64.zip miningcore && appveyor PushArtifact miningcore-win-x64.zip && cd ..\..\..
- # Build Tests
- cd ../Miningcore.Tests
- dotnet build -c Release --framework netcoreapp2.1
- dotnet build -c Release --framework netcoreapp2.2

#---------------------------------#
# tests configuration #
Expand Down
Binary file modified libs/runtimes/win-x64/libcryptonight.dll
Binary file not shown.
26 changes: 26 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.cs]
csharp_space_after_cast = true
csharp_space_after_keywords_in_control_flow_statements = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_around_binary_operators = true

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
24 changes: 12 additions & 12 deletions src/Miningcore.Tests/Blockchain/Bitcoin/BitcoinJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public BitcoinJobTests()
[Fact]
public void BitcoinJob_Should_Accept_Valid_Share()
{
var worker = new StratumClient();
var worker = new StratumClient();

worker.SetContext(new BitcoinWorkerContext
{
Difficulty = 0.5,
ExtraNonce1 = "01000058",
});
worker.SetContext(new BitcoinWorkerContext
{
Difficulty = 0.5,
ExtraNonce1 = "01000058",
});

var bt = JsonConvert.DeserializeObject<Miningcore.Blockchain.Bitcoin.DaemonResponses.BlockTemplate>(
"{\"Version\":536870912,\"PreviousBlockhash\":\"000000000909578519b5be7b37fdc53b2923817921c43108a907b72264da76bb\",\"CoinbaseValue\":5000000000,\"Target\":\"7fffff0000000000000000000000000000000000000000000000000000000000\",\"NonceRange\":\"00000000ffffffff\",\"CurTime\":1508869874,\"Bits\":\"207fffff\",\"Height\":14,\"Transactions\":[],\"CoinbaseAux\":{\"Flags\":\"0b2f454231362f414431322f\"},\"default_witness_commitment\":null}");
Expand Down Expand Up @@ -69,13 +69,13 @@ public void BitcoinJob_Should_Accept_Valid_Share()
[Fact]
public void BitcoinJob_Should_Not_Accept_Invalid_Share()
{
var worker = new StratumClient();
var worker = new StratumClient();

worker.SetContext(new BitcoinWorkerContext
{
Difficulty = 0.5,
ExtraNonce1 = "01000058",
});
worker.SetContext(new BitcoinWorkerContext
{
Difficulty = 0.5,
ExtraNonce1 = "01000058",
});

var bt = JsonConvert.DeserializeObject<Miningcore.Blockchain.Bitcoin.DaemonResponses.BlockTemplate>(
"{\"Version\":536870912,\"PreviousBlockhash\":\"000000000909578519b5be7b37fdc53b2923817921c43108a907b72264da76bb\",\"CoinbaseValue\":5000000000,\"Target\":\"7fffff0000000000000000000000000000000000000000000000000000000000\",\"NonceRange\":\"00000000ffffffff\",\"CurTime\":1508869874,\"Bits\":\"207fffff\",\"Height\":14,\"Transactions\":[],\"CoinbaseAux\":{\"Flags\":\"0b2f454231362f414431322f\"},\"default_witness_commitment\":null}");
Expand Down
22 changes: 11 additions & 11 deletions src/Miningcore.Tests/Blockchain/Cryptonote/CryptonoteJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public void MoneroJob_PrepareWorkerJob()
[Fact]
public void MoneroJob_Should_Accept_Valid_Share()
{
var worker = new StratumClient();
var worker = new StratumClient();

worker.SetContext(new CryptonoteWorkerContext
{
Difficulty = 1000,
});
worker.SetContext(new CryptonoteWorkerContext
{
Difficulty = 1000,
});

var bt = JsonConvert.DeserializeObject<Miningcore.Blockchain.Cryptonote.DaemonResponses.GetBlockTemplateResponse>(
"{\"blocktemplate_blob\":\"0106e7eabdcf058234351e2e6ea901a56b33bb531587424321873072d80a9e97295b6c43152b9d00000000019c0201ffe00106e3a1a0cc010275d92c0a057aa5f073079694a153d426f837f49fdb9654da10a5364e79a2086280a0d9e61d028b46dca0d04998500b40b046fd6f8bb33229e6380fd465dbb1327aa6f813d8bd80c0fc82aa0202372f076459e769116d604d30aabff7160782acc0d20e0c5cdc8963ed4e16372f8090cad2c60e02f009504ce65538bbb684b466b21be3a90e3740f185d7089d37b75f0cf62b6e7680e08d84ddcb0102cf01b85c0b592bb6e508e20b5d317052b75de121908390363201abff3476ef0180c0caf384a302024b81076c8ad0cfe84cc32fe0813d63cdd0f7d8d0e56d82aa3f58cbbe49d4c61e2b017aaf3074be7ecb30a769595758e4da7c7c87ead864baf89b679b73153dfa352c0208000000000000000000\",\"Difficulty\":2,\"Height\":224,\"prev_hash\":\"8234351e2e6ea901a56b33bb531587424321873072d80a9e97295b6c43152b9d\",\"reserved_offset\":322,\"Status\":\"OK\"}");
Expand All @@ -71,14 +71,14 @@ public void MoneroJob_Should_Accept_Valid_Share()
[Fact]
public void MoneroJob_Should_Not_Accept_Invalid_Share()
{
var worker = new StratumClient();
var worker = new StratumClient();

worker.SetContext(new CryptonoteWorkerContext
{
Difficulty = 1000,
});
worker.SetContext(new CryptonoteWorkerContext
{
Difficulty = 1000,
});

var bt = JsonConvert.DeserializeObject<Miningcore.Blockchain.Cryptonote.DaemonResponses.GetBlockTemplateResponse>(
var bt = JsonConvert.DeserializeObject<Miningcore.Blockchain.Cryptonote.DaemonResponses.GetBlockTemplateResponse>(
"{\"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, "");
Expand Down
12 changes: 6 additions & 6 deletions src/Miningcore.Tests/Blockchain/Ethereum/EthereumJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Miningcore.Tests.Blockchain.Ethereum
{
/// <summary>
/// These tests take ages to complete (> 10 min. on modern hardware)
/// due to the time it takes to generate the DAG for EthashFull
/// </summary>
public class EthereumJobTests : TestBase
/// <summary>
/// These tests take ages to complete (> 10 min. on modern hardware)
/// due to the time it takes to generate the DAG for EthashFull
/// </summary>
public class EthereumJobTests : TestBase
{
static readonly EthashFull ethash = new EthashFull(3, Path.GetTempPath());

/*
/*
[Fact]
public async Task EthereumJob_Should_Accept_Valid_Share()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Miningcore.Tests/Crypto/CrytonoteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public void Crytonight()
LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_0, 0);
var result = buf.ToHexString();
Assert.Equal("a845ffbdf83ae9a8ffa504a1011efbd5ed2294bb9da591d3b583740568402c00", result);
Array.Clear(buf,0, buf.Length);

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

LibCryptonight.Cryptonight(blobConverted, buf, CryptonightVariant.VARIANT_0, 0);
result = buf.ToHexString();
Expand Down
2 changes: 1 addition & 1 deletion src/Miningcore.Tests/Crypto/HashingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void Lyra2Rev3_Hash()
{
var hasher = new Lyra2Rev3();
var hash = new byte[32];
hasher.Digest(Enumerable.Repeat((byte)5, 80).ToArray(), hash);
hasher.Digest(Enumerable.Repeat((byte) 5, 80).ToArray(), hash);
var result = hash.ToHexString();

Assert.Equal("c56ec425ada2c8ddcb8d5a79a3a0c9d79f66318193049fb81f875c537a4f963d", result);
Expand Down
6 changes: 3 additions & 3 deletions src/Miningcore.Tests/Crypto/MerkleTreeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void MerkleTree_99HashesTest_Branches()
{

List<byte[]> hashesList = new List<byte[]>();
for (int i = 0; i < 100; i++)
for(int i = 0; i < 100; i++)
{
byte[] value = Encoding.ASCII.GetBytes(i.ToString());
byte[] hash = MerkelHash(value);
Expand All @@ -94,7 +94,7 @@ public void MerkleTree_99HashesTest_Branches()
.ToArray();


foreach (var hex in output)
foreach(var hex in output)
this.output.WriteLine(hex);

string[] expectedOutput = {
Expand All @@ -114,7 +114,7 @@ public void MerkleTree_99HashesTest_Branches()

private static byte[] MerkelHash(byte[] input)
{
using (var hash = SHA256.Create())
using(var hash = SHA256.Create())
{
var first = hash.ComputeHash(input, 0, input.Length);
return hash.ComputeHash(first);
Expand Down
4 changes: 2 additions & 2 deletions src/Miningcore.Tests/ModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static class ModuleInitializer
/// </summary>
public static void Initialize()
{
lock (initLock)
lock(initLock)
{
if (isInitialized)
if(isInitialized)
return;

var builder = new ContainerBuilder();
Expand Down
106 changes: 53 additions & 53 deletions src/Miningcore.Tests/VarDiff/VarDiffManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,67 +12,67 @@ namespace Miningcore.Tests.VarDiff
{
public class VarDiffManagerTests : TestBase
{
/*
private static readonly VarDiffConfig config = new VarDiffConfig
{
RetargetTime = 90,
MinDiff = 1000,
MaxDiff = 10000,
TargetTime = 15,
VariancePercent = 30,
MaxDelta = 1000,
};
/*
private static readonly VarDiffConfig config = new VarDiffConfig
{
RetargetTime = 90,
MinDiff = 1000,
MaxDiff = 10000,
TargetTime = 15,
VariancePercent = 30,
MaxDelta = 1000,
};

private static readonly ILogger logger = LogManager.CreateNullLogger();
private readonly MockMasterClock clock = new MockMasterClock();
private static readonly ILogger logger = LogManager.CreateNullLogger();
private readonly MockMasterClock clock = new MockMasterClock();

[Fact]
public void VarDiff_Should_Honor_MaxDelta_When_Adjusting_Up()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase {Difficulty = 7500, VarDiff = new VarDiffContext() };
[Fact]
public void VarDiff_Should_Honor_MaxDelta_When_Adjusting_Up()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase {Difficulty = 7500, VarDiff = new VarDiffContext() };

var shares = new List<long> { 2, 3, 4 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(8500));
}
var shares = new List<long> { 2, 3, 4 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(8500));
}

[Fact]
public void VarDiff_Should_Honor_MaxDelta_When_Adjusting_Down()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 7500, VarDiff = new VarDiffContext() };
[Fact]
public void VarDiff_Should_Honor_MaxDelta_When_Adjusting_Down()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 7500, VarDiff = new VarDiffContext() };

var shares = new List<long> { 2000000000, 3000000000, 4000000000 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(6500));
}
var shares = new List<long> { 2000000000, 3000000000, 4000000000 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(6500));
}

[Fact]
public void VarDiff_Should_Honor_MaxDiff_When_Adjusting_Up()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 9500, VarDiff = new VarDiffContext() };
[Fact]
public void VarDiff_Should_Honor_MaxDiff_When_Adjusting_Up()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 9500, VarDiff = new VarDiffContext() };

var shares = new List<long> { 2, 3, 4 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(10000));
}
var shares = new List<long> { 2, 3, 4 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(10000));
}

[Fact]
public void VarDiff_Should_Honor_MinDiff_When_Adjusting_Down()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 1500, VarDiff = new VarDiffContext() };
[Fact]
public void VarDiff_Should_Honor_MinDiff_When_Adjusting_Down()
{
var vdm = new VarDiffManager(config, clock);
var ctx = new WorkerContextBase { Difficulty = 1500, VarDiff = new VarDiffContext() };

var shares = new List<long> { 2000000000, 3000000000, 4000000000 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(1000));
}
*/
var shares = new List<long> { 2000000000, 3000000000, 4000000000 };
var newDiff = vdm.Update(ctx, shares, string.Empty, logger);
Assert.NotNull(newDiff);
Assert.True(newDiff.Value.EqualsDigitPrecision3(1000));
}
*/
}
}
9 changes: 7 additions & 2 deletions src/Miningcore.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
# Visual Studio Version 16
VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Miningcore", "Miningcore\Miningcore.csproj", "{A427248A-B5E1-4808-9883-BC2AD68EE997}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Miningcore.Tests", "Miningcore.Tests\Miningcore.Tests.csproj", "{DCDE9CE6-84B8-42FE-AA55-2A3909A5E757}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{71672AAD-51F8-49EC-9EFD-E504D65A765A}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion src/Miningcore/Api/Controllers/AdminApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task<object> AddMinerBalanceAsync(AddBalanceRequest request)
{
request.Usage = request.Usage?.Trim();

if (string.IsNullOrEmpty(request.Usage))
if(string.IsNullOrEmpty(request.Usage))
request.Usage = $"Admin balance change from {Request.HttpContext.Connection.RemoteIpAddress}";

var oldBalance = await cf.Run(con => balanceRepo.GetBalanceAsync(con, request.PoolId, request.Address));
Expand Down
Loading