Skip to content

Commit

Permalink
Round optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Sep 7, 2024
1 parent 2bf73e0 commit 6473344
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
12 changes: 9 additions & 3 deletions dkgServiceNode/Controllers/OpsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ public async Task<ActionResult<StatusResponse>> RegisterNode(Node node)
if (xNode == null)
{
node.RoundId = roundId;
node.CalculateRandom();
if (roundId == null) node.StatusValue = (short)NStatus.NotRegistered;
await dkgContext.AddNodeAsync(node);
if (roundId == null)
{
node.StatusValue = (short)NStatus.NotRegistered;
}
else
{
node.CalculateRandom();
await dkgContext.AddNodeAsync(node);
}
xNode = dkgContext.GetNodeByAddress(node.Address);
}
else
Expand Down
1 change: 1 addition & 0 deletions dkgServiceNode/Data/DbEnsure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public static void Ensure(string connectionString)
PuVersionUpdate("0.11.0", connection);
EnsureVersion("0.12.1", sqlScript_0_12_1, connection);
PuVersionUpdate("0.12.2", connection);
PuVersionUpdate("0.12.3", connection);
}
}

Expand Down
5 changes: 4 additions & 1 deletion dkgServiceNode/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

builder.Services.AddDbContext<VersionContext>(options => options.UseNpgsql(connectionString));
builder.Services.AddDbContext<UserContext>(options => options.UseNpgsql(connectionString));
builder.Services.AddDbContext<DkgContext>(options => options.UseNpgsql(connectionString));
builder.Services.AddDbContext<DkgContext>(options => {
options.UseNpgsql(connectionString);
options.EnableSensitiveDataLogging();
});

builder.Services.AddSingleton<Runner>();
builder.Services.AddSingleton<NodesCache>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public async Task InvokeAsync(HttpContext context)
}
else
{
// If not the specific controller, just pass through
await _next(context);
}
}
Expand Down
6 changes: 3 additions & 3 deletions dkgServiceNode/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information",
"Microsoft.EntityFrameworkCore": "Information"
"Default": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*",
Expand Down

0 comments on commit 6473344

Please sign in to comment.