From 3669bc2ca42e388947bd8f8ad96492e994250327 Mon Sep 17 00:00:00 2001 From: joohansson Date: Fri, 28 Jun 2019 08:50:01 +0200 Subject: [PATCH 1/2] Added block_count_cemented New rpc call to include cemented blocks. Available from node v19+ --- src/nano/rpc.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/nano/rpc.py b/src/nano/rpc.py index bdd2ed3..3f644de 100644 --- a/src/nano/rpc.py +++ b/src/nano/rpc.py @@ -915,6 +915,32 @@ def block_count(self): resp[k] = int(v) return resp + + @doc_metadata(categories=['global', 'block']) + def block_count_cemented(self): + """ + Reports the number of blocks in the ledger and unchecked synchronizing + blocks + + :raises: :py:exc:`nano.rpc.RPCException` + + >>> rpc.block_count_cemented() + { + "count": 1000, + "unchecked": 10, + "cemented": 1000 + } + + """ + + payload = {"include_cemented": "true"} + + resp = self.call('block_count', payload) + + for k, v in resp.items(): + resp[k] = int(v) + + return resp @doc_metadata(categories=['global', 'block']) def block_count_type(self): From e211df310187f826ef7ebfea00d070139ac83630 Mon Sep 17 00:00:00 2001 From: joohansson Date: Fri, 28 Jun 2019 08:52:35 +0200 Subject: [PATCH 2/2] Proper description for block_count_cemented --- src/nano/rpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nano/rpc.py b/src/nano/rpc.py index 3f644de..c1e7413 100644 --- a/src/nano/rpc.py +++ b/src/nano/rpc.py @@ -919,8 +919,8 @@ def block_count(self): @doc_metadata(categories=['global', 'block']) def block_count_cemented(self): """ - Reports the number of blocks in the ledger and unchecked synchronizing - blocks + Reports the number of blocks in the ledger, unchecked synchronizing + blocks and cemented blocks. Available from node v19+. :raises: :py:exc:`nano.rpc.RPCException`