Skip to content

Commit

Permalink
fix control service
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Nov 1, 2023
1 parent 5e2647d commit 3f27a2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void AddTxQuota(Address address, int quota)
using var command = connection.CreateCommand();
command.CommandText = AddTxQuotaSql;
command.Parameters.AddWithValue("@Address", address.ToString());
command.Parameters.AddWithValue("@Quota", quota.ToString());
command.Parameters.AddWithValue("@Quota", quota);
command.ExecuteNonQuery();
}

Expand Down
5 changes: 3 additions & 2 deletions NineChronicles.Headless/Services/RedisAccessControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public bool IsAccessDenied(Address address)
if (!result.IsNull)
{
Log.ForContext("Source", nameof(IAccessControlService))
.Debug("\"{Address}\" access level: {level}", address, result);
.Debug("\"{Address}\" Tx Quota: {Quota}", address, result);
return Convert.ToInt32(result);
}

return Convert.ToInt32(result);
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ public bool IsAccessDenied(Address address)

var queryResult = command.ExecuteScalar();

return Convert.ToInt32(queryResult);
if (queryResult != null)
{
return Convert.ToInt32(queryResult);
}

return null;
}
}
}

0 comments on commit 3f27a2f

Please sign in to comment.