Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Apr 20, 2021
1 parent e06c415 commit f004005
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private JObject GetInvokeResult(byte[] script, Signers signers = null)
json["exception"] = GetExceptionMessage(engine.FaultException);
try
{
json["stack"] = new JArray(engine.ResultStack.Select(p => ToJson(p, settings.MaxResultItems)));
json["stack"] = new JArray(engine.ResultStack.Select(p => ToJson(p, settings.MaxIteratorResultItems)));
}
catch (InvalidOperationException)
{
Expand Down
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"MaxGasInvoke": 20,
"MaxFee": 0.1,
"MaxConcurrentConnections": 40,
"MaxResultItems": 100,
"MaxIteratorResultItems": 100,
"DisabledMethods": [ "openwallet" ]
}
]
Expand Down
6 changes: 3 additions & 3 deletions src/RpcServer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public record RpcServerSettings
public string RpcPass { get; init; }
public long MaxGasInvoke { get; init; }
public long MaxFee { get; init; }
public int MaxIteratorResultItems { get; init; }
public string[] DisabledMethods { get; init; }
public int MaxResultItems { get; init; }

public static RpcServerSettings Default { get; } = new RpcServerSettings
{
Expand All @@ -42,9 +42,9 @@ public record RpcServerSettings
MaxGasInvoke = (long)new BigDecimal(10M, NativeContract.GAS.Decimals).Value,
MaxFee = (long)new BigDecimal(0.1M, NativeContract.GAS.Decimals).Value,
TrustedAuthorities = Array.Empty<string>(),
MaxIteratorResultItems = 100,
DisabledMethods = Array.Empty<string>(),
MaxConcurrentConnections = 40,
MaxResultItems = 100,
};

public static RpcServerSettings Load(IConfigurationSection section) => new RpcServerSettings
Expand All @@ -59,9 +59,9 @@ public record RpcServerSettings
RpcPass = section.GetSection("RpcPass").Value,
MaxGasInvoke = (long)new BigDecimal(section.GetValue<decimal>("MaxGasInvoke", Default.MaxGasInvoke), NativeContract.GAS.Decimals).Value,
MaxFee = (long)new BigDecimal(section.GetValue<decimal>("MaxFee", Default.MaxFee), NativeContract.GAS.Decimals).Value,
MaxIteratorResultItems = section.GetValue("MaxIteratorResultItems", Default.MaxIteratorResultItems),
DisabledMethods = section.GetSection("DisabledMethods").GetChildren().Select(p => p.Get<string>()).ToArray(),
MaxConcurrentConnections = section.GetValue("MaxConcurrentConnections", Default.MaxConcurrentConnections),
MaxResultItems = section.GetValue("MaxResultItems", Default.MaxResultItems),
};
}
}

0 comments on commit f004005

Please sign in to comment.