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

Commit

Permalink
Make Ergo network detection more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Weichhold committed Jul 17, 2022
1 parent a42cf7a commit c58a647
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Miningcore/Blockchain/Ergo/ErgoJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,16 @@ protected override async Task PostStartInitAsync(CancellationToken ct)
blockVersion = info.Parameters.BlockVersion;

// chain detection
var m = ErgoConstants.RegexChain.Match(info.Name);
if(!m.Success)
throw new PoolStartupException($"Unable to identify network type ({info.Name}", poolConfig.Id);
if(!string.IsNullOrEmpty(info.Network))
network = info.Network.ToLower();
else
{
var m = ErgoConstants.RegexChain.Match(info.Name);
if(!m.Success)
throw new PoolStartupException($"Unable to identify network type ({info.Name}", poolConfig.Id);

network = m.Groups[1].Value.ToLower();
network = m.Groups[1].Value.ToLower();
}

// Payment-processing setup
if(clusterConfig.PaymentProcessing?.Enabled == true && poolConfig.PaymentProcessing?.Enabled == true)
Expand Down
4 changes: 4 additions & 0 deletions src/Miningcore/Blockchain/Ergo/RPC/ErgoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10897,6 +10897,10 @@ public partial class NodeInfo
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Name { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("network", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Network { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("appVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string AppVersion { get; set; } = default!;
Expand Down

0 comments on commit c58a647

Please sign in to comment.