Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend rpc version #878

Merged
merged 9 commits into from
Feb 26, 2024
29 changes: 18 additions & 11 deletions src/RpcServer/RpcServer.Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,31 @@ protected virtual JToken GetVersion(JArray _params)
json["tcpport"] = localNode.ListenerTcpPort;
json["nonce"] = LocalNode.Nonce;
json["useragent"] = LocalNode.UserAgent;
json["protocol"] = new JObject();
json["protocol"]["addressversion"] = system.Settings.AddressVersion;
json["protocol"]["network"] = system.Settings.Network;
json["protocol"]["validatorscount"] = system.Settings.ValidatorsCount;
json["protocol"]["msperblock"] = system.Settings.MillisecondsPerBlock;
json["protocol"]["maxtraceableblocks"] = system.Settings.MaxTraceableBlocks;
json["protocol"]["maxvaliduntilblockincrement"] = system.Settings.MaxValidUntilBlockIncrement;
json["protocol"]["maxtransactionsperblock"] = system.Settings.MaxTransactionsPerBlock;
json["protocol"]["memorypoolmaxtransactions"] = system.Settings.MemoryPoolMaxTransactions;
json["protocol"]["initialgasdistribution"] = system.Settings.InitialGasDistribution;
json["protocol"]["hardforks"] = new JArray(system.Settings.Hardforks.Select(hf =>
// rpc settings
roman-khimov marked this conversation as resolved.
Show resolved Hide resolved
JObject rpc = new();
rpc["maxiteratorresultitems"] = settings.MaxIteratorResultItems;
shargon marked this conversation as resolved.
Show resolved Hide resolved
rpc["sessionenabled"] = settings.SessionEnabled;
// protocol settings
JObject protocol = new();
roman-khimov marked this conversation as resolved.
Show resolved Hide resolved
protocol["addressversion"] = system.Settings.AddressVersion;
protocol["network"] = system.Settings.Network;
protocol["validatorscount"] = system.Settings.ValidatorsCount;
protocol["msperblock"] = system.Settings.MillisecondsPerBlock;
protocol["maxtraceableblocks"] = system.Settings.MaxTraceableBlocks;
protocol["maxvaliduntilblockincrement"] = system.Settings.MaxValidUntilBlockIncrement;
protocol["maxtransactionsperblock"] = system.Settings.MaxTransactionsPerBlock;
protocol["memorypoolmaxtransactions"] = system.Settings.MemoryPoolMaxTransactions;
protocol["initialgasdistribution"] = system.Settings.InitialGasDistribution;
protocol["hardforks"] = new JArray(system.Settings.Hardforks.Select(hf =>
{
JObject forkJson = new();
// Strip "HF_" prefix.
forkJson["name"] = StripPrefix(hf.Key.ToString(), "HF_");
forkJson["blockheight"] = hf.Value;
shargon marked this conversation as resolved.
Show resolved Hide resolved
shargon marked this conversation as resolved.
Show resolved Hide resolved
return forkJson;
}));
json["rpc"] = rpc;
shargon marked this conversation as resolved.
Show resolved Hide resolved
json["protocol"] = protocol;
shargon marked this conversation as resolved.
Show resolved Hide resolved
roman-khimov marked this conversation as resolved.
Show resolved Hide resolved
return json;
}

Expand Down
Loading