Skip to content

Commit

Permalink
Add Getcommittee (neo-project#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud8little authored and 陈志同 committed Sep 23, 2020
1 parent 01a1ba3 commit d755e99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/RpcClient/RpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ public RpcValidator[] GetValidators()
return ((JArray)RpcSend("getvalidators")).Select(p => RpcValidator.FromJson(p)).ToArray();
}

/// <summary>
/// Returns the current NEO committee members.
/// </summary>
public string[] GetCommittee()
{
return ((JArray)RpcSend("getcommittee")).Select(p => p.AsString()).ToArray();
}

#endregion Blockchain

#region Node
Expand Down
7 changes: 7 additions & 0 deletions src/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,12 @@ private JObject GetValidators(JArray _params)
return validator;
}).ToArray();
}

[RpcMethod]
private JObject GetCommittee(JArray _params)
{
using SnapshotView snapshot = Blockchain.Singleton.GetSnapshot();
return new JArray(NativeContract.NEO.GetCommittee(snapshot).Select(p => (JObject)p.ToString()));
}
}
}

0 comments on commit d755e99

Please sign in to comment.