Skip to content

Commit

Permalink
Merge branch 'master' into consensus/improved_dbft
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored Feb 21, 2019
2 parents 68322a4 + 2bff318 commit 2c56c07
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 3 additions & 3 deletions neo/Ledger/AccountState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ public override JObject ToJson()
JObject json = base.ToJson();
json["script_hash"] = ScriptHash.ToString();
json["frozen"] = IsFrozen;
json["votes"] = new JArray(Votes.Select(p => (JObject)p.ToString()));
json["balances"] = new JArray(Balances.Select(p =>
json["votes"] = Votes.Select(p => (JObject)p.ToString()).ToArray();
json["balances"] = Balances.Select(p =>
{
JObject balance = new JObject();
balance["asset"] = p.Key.ToString();
balance["value"] = p.Value.ToString();
return balance;
}));
}).ToArray();
return json;
}
}
Expand Down
11 changes: 10 additions & 1 deletion neo/NeoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Neo.Wallets;
using System;
using System.Net;
using System.Threading;

namespace Neo
{
Expand Down Expand Up @@ -42,10 +43,18 @@ public NeoSystem(Store store)
public void Dispose()
{
RpcServer?.Dispose();
ActorSystem.Stop(LocalNode);
EnsureStoped(LocalNode);
ActorSystem.Dispose();
}

public void EnsureStoped(IActorRef actor)
{
Inbox inbox = Inbox.Create(ActorSystem);
inbox.Watch(actor);
ActorSystem.Stop(actor);
inbox.Receive(Timeout.InfiniteTimeSpan);
}

internal void ResumeNodeStartup()
{
suspend = false;
Expand Down
8 changes: 8 additions & 0 deletions neo/Network/RPC/RpcServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,14 @@ private JObject ProcessRequest(HttpContext context, JObject request)
if (result == null)
result = Process(method, _params);
}
catch (FormatException)
{
return CreateErrorResponse(request["id"], -32602, "Invalid params");
}
catch (IndexOutOfRangeException)
{
return CreateErrorResponse(request["id"], -32602, "Invalid params");
}
catch (Exception ex)
{
#if DEBUG
Expand Down

0 comments on commit 2c56c07

Please sign in to comment.