diff --git a/mmgen/node_tools/BlocksInfo.py b/mmgen/node_tools/BlocksInfo.py index 55e2b7a..c25d1a2 100644 --- a/mmgen/node_tools/BlocksInfo.py +++ b/mmgen/node_tools/BlocksInfo.py @@ -242,7 +242,7 @@ class BlocksInfo: yield (ls + self.fields[name].fs.replace(':',repl) + rs) def conv_blkspec(self,arg): - if arg == 'cur': + if str(arg).lower() == 'cur': return self.tip elif is_int(arg): if int(arg) < 0: diff --git a/mmnode-blocks-info b/mmnode-blocks-info index e7a79fa..2a8c9c6 100755 --- a/mmnode-blocks-info +++ b/mmnode-blocks-info @@ -34,9 +34,9 @@ opts_data = { ], 'text': { 'desc': 'Display information about a block or range of blocks', - 'usage': '[opts] blocknum [blocknum ...] | blocknum-blocknum[+step] | [blocknum|-nBlocks]+nBlocks[+step]', + 'usage': '[opts] blocknum ... | blocknum-blocknum[+step] | [blocknum|-nBlocks]+nBlocks[+step]', 'usage2': [ - '[opts] blocknum [blocknum ...]', + '[opts] blocknum ...', '[opts] blocknum-blocknum[+step]', '[opts] [blocknum|-nBlocks]+nBlocks[+step]', ], @@ -116,14 +116,14 @@ EXAMPLES: Display only range stats for the last ten blocks: $ {p} -o none -s range +10 - Display data for the last ten blocks, skipping 'size' and 'subsidy' - fields and stats: + Display data for the last ten blocks, omitting the 'size' and 'subsidy' + fields from the defaults and skipping stats: $ {p} -o -size,subsidy -s none +10 Display all fields and stats for the last ten blocks: $ {p} -o all -s all +10 - Same as above, but display only relevant fields: + Same as above, but display only fields relating to stats: $ {p} -o none -s all -f +10 Same as above, but display stats only: diff --git a/test/unit_tests_d/nt_BlocksInfo.py b/test/unit_tests_d/nt_BlocksInfo.py index ea10655..96b7299 100755 --- a/test/unit_tests_d/nt_BlocksInfo.py +++ b/test/unit_tests_d/nt_BlocksInfo.py @@ -9,7 +9,7 @@ from mmgen.exception import * from mmgen.node_tools.BlocksInfo import BlocksInfo tip = 50000 -vecs = ( +range_vecs = ( # First Last FromTip nBlocks Step First Last BlockList ( (), (), (tip, tip, None) ), ( (199,2,37), (), (None, None, [199,2,37]) ), @@ -36,8 +36,8 @@ vecs = ( ( '-10+11', (tip-10, tip, 10, 11, None), (tip-10, tip, None) ), ( '-10+11+2', (tip-10, tip, 10, 11, 2 ), (tip-10, tip, list(range(tip-10,tip+1,2))) ), - ( 'cur', (tip, tip, None, None, None), (tip, tip, None) ), - ( 'cur-cur', (tip, tip, None, None, None), (tip, tip, None) ), + ( 'cUr', (tip, tip, None, None, None), (tip, tip, None) ), + ( 'cur-cUR', (tip, tip, None, None, None), (tip, tip, None) ), ( '0-cur', (0, tip, None, None, None), (0, tip, None) ), (f'{tip-1}-cur', (tip-1, tip, None, None, None), (tip-1, tip, None) ), ( '0-cur+3000', (0, tip, None, None, 3000 ), (0, tip, list(range(0,tip+1,3000))) ), @@ -57,7 +57,7 @@ class dummyOpt: class unit_tests: - def rangespec(self,name,ut): + def parse_rangespec(self,name,ut): b = BlocksInfo(0,dummyOpt(),dummyRPC()) @@ -66,7 +66,7 @@ class unit_tests: vmsg(f'{spec:13} => {BlocksInfo.range_data(*chk)}') assert ret == chk, f'{ret} != {chk}' - for vec in vecs: + for vec in range_vecs: if vec[1]: test(*vec) @@ -80,7 +80,7 @@ class unit_tests: vmsg('{:13} => {}'.format(repr(spec) if type(spec) == tuple else spec,chk)) assert ret == chk, f'{ret} != {chk}' - for vec in vecs: + for vec in range_vecs: test(*vec) return True