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

Commit 05b7810

Browse files
author
Oliver Weichhold
authored
Merge pull request #1130 from oliverw/oliverw
- Implement support for Postgres TLS - Don't expose Ergo Wallet Password through API - Don't expose confidential Tls information through API - Fixed a bug that would delay job updates to all miners if the previous update was delayed due to a dead connection - Remove artificial outbound stratum message length and optimize memory usage - Re-introduce Ethereum Job backlog - Build script fixes (@warren-ru)
2 parents fb0f2f7 + c7a59d3 commit 05b7810

File tree

81 files changed

+1114
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1114
-1197
lines changed

src/.idea/.idea.Miningcore/.idea/dataSources.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/.idea/.idea.Miningcore/.idea/inspectionProfiles/Project_Default.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/.idea/.idea.Miningcore/.idea/sqldialects.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Miningcore/Api/Controllers/AdminApiController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public async Task<decimal> GetMinerBalanceAsync(string poolId, string address)
6666
if(string.IsNullOrEmpty(address))
6767
throw new ApiException("Invalid or missing miner address", HttpStatusCode.NotFound);
6868

69-
var result = await cf.Run(con=> minerRepo.GetSettings(con, null, pool.Id, address));
69+
var result = await cf.Run(con=> minerRepo.GetSettingsAsync(con, null, pool.Id, address));
7070

7171
if(result == null)
7272
throw new ApiException("No settings found", HttpStatusCode.NotFound);
@@ -98,9 +98,9 @@ public async Task<decimal> GetMinerBalanceAsync(string poolId, string address)
9898

9999
var result = await cf.RunTx(async (con, tx) =>
100100
{
101-
await minerRepo.UpdateSettings(con, tx, mapped);
101+
await minerRepo.UpdateSettingsAsync(con, tx, mapped);
102102

103-
return await minerRepo.GetSettings(con, tx, mapped.PoolId, mapped.Address);
103+
return await minerRepo.GetSettingsAsync(con, tx, mapped.PoolId, mapped.Address);
104104
});
105105

106106
logger.Info(()=> $"Updated settings for pool {pool.Id}, miner {address}");

src/Miningcore/Api/Controllers/ClusterApiController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ public ClusterApiController(IComponentContext ctx) : base(ctx)
3838
public async Task<Responses.Block[]> PageBlocksPagedAsync(
3939
[FromQuery] int page, [FromQuery] int pageSize = 15, [FromQuery] BlockStatus[] state = null)
4040
{
41-
var blockStates = state != null && state.Length > 0 ?
41+
var ct = HttpContext.RequestAborted;
42+
var blockStates = state is { Length: > 0 } ?
4243
state :
4344
new[] { BlockStatus.Confirmed, BlockStatus.Pending, BlockStatus.Orphaned };
4445

45-
var blocks = (await cf.Run(con => blocksRepo.PageBlocksAsync(con, blockStates, page, pageSize)))
46+
var blocks = (await cf.Run(con => blocksRepo.PageBlocksAsync(con, blockStates, page, pageSize, ct)))
4647
.Select(mapper.Map<Responses.Block>)
4748
.Where(x => enabledPools.Contains(x.PoolId))
4849
.ToArray();

src/Miningcore/Api/Controllers/PoolApiController.cs

Lines changed: 53 additions & 42 deletions
Large diffs are not rendered by default.

src/Miningcore/Api/Extensions/MiningPoolExtensions.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using AutoMapper;
22
using Miningcore.Api.Responses;
33
using Miningcore.Blockchain;
4+
using Miningcore.Blockchain.Ergo.Configuration;
45
using Miningcore.Configuration;
6+
using Miningcore.Extensions;
57
using Miningcore.Mining;
68

79
namespace Miningcore.Api.Extensions;
@@ -28,9 +30,19 @@ public static PoolInfo ToPoolInfo(this PoolConfig poolConfig, IMapper mapper, Pe
2830
{
2931
var extra = poolInfo.PaymentProcessing.Extra;
3032

31-
//extra.StripValue(nameof(EthereumPoolPaymentProcessingConfigExtra.CoinbasePassword));
33+
extra.StripValue(nameof(ErgoPaymentProcessingConfigExtra.WalletPassword));
3234
}
3335

36+
if(poolInfo.Ports != null)
37+
{
38+
foreach(var port in poolInfo.Ports.Keys)
39+
{
40+
var portInfo = poolInfo.Ports[port];
41+
42+
portInfo.TlsPfxFile = null;
43+
portInfo.TlsPfxPassword = null;
44+
}
45+
}
3446
return poolInfo;
3547
}
3648
}

src/Miningcore/Api/Responses/GetPoolsResponse.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Miningcore.Blockchain;
33
using Miningcore.Configuration;
44
using Miningcore.Mining;
5-
using Newtonsoft.Json;
65
using Newtonsoft.Json.Linq;
76

87
namespace Miningcore.Api.Responses;

src/Miningcore/AutoMapperProfile.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Miningcore.Configuration;
44
using Miningcore.Persistence.Model;
55
using Miningcore.Persistence.Model.Projections;
6+
using Newtonsoft.Json.Linq;
67
using MinerStats = Miningcore.Persistence.Model.Projections.MinerStats;
78

89
namespace Miningcore;
@@ -13,6 +14,9 @@ public class AutoMapperProfile : Profile
1314

1415
public AutoMapperProfile()
1516
{
17+
// Fix for Automapper 11 which chokes on recursive objects such as JToken
18+
CreateMap<JToken, JToken>().ConvertUsing(x=> x);
19+
1620
//////////////////////
1721
// outgoing mappings
1822

src/Miningcore/AutofacMetadata.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
using JetBrains.Annotations;
21
using Miningcore.Configuration;
32

43
namespace Miningcore;
54

65
public class CoinFamilyAttribute : Attribute
76
{
8-
[UsedImplicitly]
9-
public CoinFamilyAttribute(IDictionary<string, object> values)
7+
public CoinFamilyAttribute(IDictionary<string, object> values)
108
{
119
if(values.ContainsKey(nameof(SupportedFamilies)))
1210
SupportedFamilies = (CoinFamily[]) values[nameof(SupportedFamilies)];

0 commit comments

Comments
 (0)