From 1b6ecbfc815291920aa2a797f7ce47c5b3d1fe87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 10 Apr 2017 15:54:34 +0200 Subject: [PATCH] Shell/RPC: simplify block-watcher signature --- src/node/shell/node.ml | 22 +--------------------- src/node/shell/node.mli | 2 +- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/node/shell/node.ml b/src/node/shell/node.ml index 7e2121fde..4cc5779fb 100644 --- a/src/node/shell/node.ml +++ b/src/node/shell/node.ml @@ -166,21 +166,6 @@ module RPC = struct test_network = block.test_network ; } - let convert_block hash ({ shell ; proto }: State.Block_header.t) = { - net = shell.net_id ; - hash = hash ; - level = shell.level ; - predecessor = shell.predecessor ; - fitness = shell.fitness ; - timestamp = shell.timestamp ; - protocol = None ; - operations_hash = shell.operations ; - operations = None ; - data = Some proto ; - test_protocol = None ; - test_network = None ; - } - let inject_block node = node.inject_block let inject_operation node = node.inject_operation let inject_protocol node = node.inject_protocol @@ -534,12 +519,7 @@ module RPC = struct heads >>= fun (_, blocks) -> Lwt.return (List.rev blocks) - let block_watcher node = - let stream, shutdown = Distributed_db.watch_block node.distributed_db in - Lwt_stream.map - (fun (hash, block) -> convert_block hash block) - stream, - shutdown + let block_watcher node = Distributed_db.watch_block node.distributed_db let valid_block_watcher node = let stream, shutdown = Validator.global_watcher node.validator in diff --git a/src/node/shell/node.mli b/src/node/shell/node.mli index edfd4351d..705301a78 100644 --- a/src/node/shell/node.mli +++ b/src/node/shell/node.mli @@ -44,7 +44,7 @@ module RPC : sig val raw_block_info: t -> Block_hash.t -> block_info Lwt.t val block_watcher: - t -> block_info Lwt_stream.t * Watcher.stopper + t -> (Block_hash.t * Store.Block_header.t) Lwt_stream.t * Watcher.stopper val valid_block_watcher: t -> (block_info Lwt_stream.t * Watcher.stopper) val heads: t -> block_info Block_hash.Map.t Lwt.t