use mmgen launcher; init fixes; blocks-info: improve miner string parsing

This commit is contained in:
The MMGen Project 2022-02-11 09:48:08 +00:00
commit 3d62ff8211
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
20 changed files with 130 additions and 13 deletions

View file

@ -17,6 +17,8 @@ Then,
$ python3 -m build --no-isolation
$ python3 -m pip install --user dist/*.whl
Also make sure that `~/.local/bin` is in `PATH`.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[**Forum**][4] |

17
cmds/mmnode-blocks-info Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-blocks-info: Display information about a block or range of blocks
"""
from mmgen.main import launch
launch('blocks_info',package='mmgen_node_tools')

17
cmds/mmnode-feeview Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-feeview: Visualize the fee structure of a node’s mempool
"""
from mmgen.main import launch
launch('feeview',package='mmgen_node_tools')

17
cmds/mmnode-halving-calculator Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-halving-calculator: Estimate date(s) of future block subsidy halving(s)
"""
from mmgen.main import launch
launch('halving_calculator',package='mmgen_node_tools')

17
cmds/mmnode-netrate Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-netrate: Bitcoin daemon network rate monitor
"""
from mmgen.main import launch
launch('netrate',package='mmgen_node_tools')

17
cmds/mmnode-peerblocks Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-peerblocks: List blocks in flight, disconnect stalling nodes
"""
from mmgen.main import launch
launch('peerblocks',package='mmgen_node_tools')

17
cmds/mmnode-txfind Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
# https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
"""
mmnode-txfind: Find a transaction in the blockchain or mempool
"""
from mmgen.main import launch
launch('txfind',package='mmgen_node_tools')

13
mmgen_node_tools/BlocksInfo.py Normal file → Executable file
View file

@ -226,15 +226,18 @@ class BlocksInfo:
)
if 'miner' in self.fnames:
# capturing parens must contain only ASCII chars!
self.miner_pats = [re.compile(pat) for pat in (
rb'`/([_a-zA-Z0-9&. #/-]+)/',
rb'[\xe3\xe4\xe5][\^/](.*?)\xfa',
rb'[\xe3\xe4\xe5][\^/]([\x20-\x7e]+?)\xfa',
rb'([a-zA-Z0-9&. -]+/Mined by [a-zA-Z0-9. ]+)',
rb'\x08/(.*Mined by [a-zA-Z0-9. ]+)',
rb'Mined by ([a-zA-Z0-9. ]+)',
rb'[`]([_a-zA-Z0-9&. #/-]+)[/\xfa]',
rb'([\x20-\x7e]{9,})',
rb'[/^]([a-zA-Z0-9&. #/-]{5,})',
rb'[/^]([_a-zA-Z0-9&. #/-]+)/',
rb'^\x03...\W{0,5}([\\_a-zA-Z0-9&. #/-]+)[/\\]',
)]
self.block_data = namedtuple('block_data',self.fnames)
@ -428,10 +431,16 @@ class BlocksInfo:
if self.opt.raw_miner_info:
return repr(cb)
else:
trmap_in = {
'\\': ' ',
'/': ' ',
',': ' ',
}
trmap = { ord(a):b for a,b in trmap_in.items() }
for pat in self.miner_pats:
m = pat.search(cb)
if m:
return ''.join(chr(b) for b in m[1] if 31 < b < 127).strip('^').strip('/').replace('/',' ')
return re.sub( r'\s+', ' ', m[1].decode().strip('^').translate(trmap).strip() )
return ''
def print_header(self):

0
mmgen_node_tools/Sound.py Normal file → Executable file
View file

0
mmgen_node_tools/Term.py Normal file → Executable file
View file

0
mmgen_node_tools/Util.py Normal file → Executable file
View file

0
mmgen_node_tools/__init__.py Normal file → Executable file
View file

View file

@ -1 +1 @@
3.0.0
3.1.dev1

View file

@ -21,7 +21,7 @@ mmnode-blocks-info: Display information about a block or range of blocks
"""
from mmgen.common import *
from mmgen_node_tools.BlocksInfo import BlocksInfo,JSONBlocksInfo
from .BlocksInfo import BlocksInfo,JSONBlocksInfo
opts_data = {
'sets': [

View file

@ -125,9 +125,12 @@ def create_data(coin_amt,mempool):
break
# remove empty top brackets:
while out[-1].tx_bytes == 0:
while out and out[-1].tx_bytes == 0:
out.pop()
if not out:
die(1,'No data!')
out.reverse() # cumulative totals and display are top-down
# calculate cumulative byte totals, filter rows:
@ -197,7 +200,7 @@ def gen_body(data):
async def main():
from mmgen.protocol import init_proto_from_opts
proto = init_proto_from_opts()
proto = init_proto_from_opts(need_amt=True)
from mmgen.rpc import rpc_init
c = await rpc_init(proto)
@ -210,6 +213,7 @@ async def main():
log(mempool,'mempool.json')
data = create_data(proto.coin_amt,mempool)
(do_pager if opt.pager else print)(
'\n'.join(gen_header(c.host,await c.call('getblockcount'))) + '\n' +
'\n'.join(gen_body(data))

View file

@ -62,7 +62,7 @@ def time_diff_warning(t_diff):
async def main():
from mmgen.protocol import init_proto_from_opts
proto = init_proto_from_opts()
proto = init_proto_from_opts(need_amt=True)
from mmgen.rpc import rpc_init
c = await rpc_init(proto)

View file

@ -23,14 +23,14 @@ python_requires = >=3.7
include_package_data = True
install_requires =
mmgen>=13.0.0
mmgen>=13.1.dev19
packages =
mmgen_node_tools
scripts =
mmnode-blocks-info
mmnode-feeview
mmnode-halving-calculator
mmnode-netrate
mmnode-peerblocks
cmds/mmnode-blocks-info
cmds/mmnode-feeview
cmds/mmnode-halving-calculator
cmds/mmnode-netrate
cmds/mmnode-peerblocks