Add an system_syncState RPC method (#7315)

* Add system_syncState RPC method

* Update client/rpc-api/src/system/helpers.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Pierre Krieger
2020-10-13 17:53:49 +02:00
committed by GitHub
parent e4cb862123
commit bcde7b4f3f
6 changed files with 83 additions and 5 deletions
+19
View File
@@ -104,6 +104,13 @@ fn api<T: Into<Option<Status>>>(sync: T) -> System<Block> {
Request::NodeRoles(sender) => {
let _ = sender.send(vec![NodeRole::Authority]);
}
Request::SyncState(sender) => {
let _ = sender.send(SyncState {
starting_block: 1,
current_block: 2,
highest_block: Some(3),
});
}
};
future::ready(())
@@ -291,6 +298,18 @@ fn system_node_roles() {
);
}
#[test]
fn system_sync_state() {
assert_eq!(
wait_receiver(api(None).system_sync_state()),
SyncState {
starting_block: 1,
current_block: 2,
highest_block: Some(3),
}
);
}
#[test]
fn system_network_add_reserved() {
let good_peer_id = "/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV";