update for MMGen v13.3.dev44

This commit is contained in:
The MMGen Project 2023-04-04 16:00:29 +00:00
commit a1beac67e2
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
11 changed files with 45 additions and 35 deletions

View file

@ -24,7 +24,7 @@ import re,json
from collections import namedtuple
from time import strftime,gmtime
from mmgen.common import *
from mmgen.util import msg,Msg,Msg_r,die,suf,secs_to_ms,secs_to_dhms,is_int
from mmgen.rpc import json_encoder
class BlocksInfo:
@ -362,7 +362,8 @@ class BlocksInfo:
first = self.conv_blkspec(first)
last = self.conv_blkspec(last or first)
if p.debug: msg(repr(self.range_data(first,last,from_tip,nblocks,step)))
if p.debug:
msg(repr(self.range_data(first,last,from_tip,nblocks,step)))
if first > last:
die(1,f'{first}-{last}: invalid block range')

View file

@ -1 +1 @@
3.1.dev16
3.1.dev17

View file

@ -12,7 +12,10 @@
mmnode-addrbal: Get balances for arbitrary addresses in the blockchain
"""
from mmgen.common import *
from mmgen.obj import CoinTxID,Int
from mmgen.cfg import Config
from mmgen.util import msg,Msg,die,suf,make_timestr,async_run
from mmgen.color import red
opts_data = {
'text': {
@ -115,7 +118,7 @@ async def main(req_addrs):
addrs = [CoinAddr(proto,addr) for addr in req_addrs]
from mmgen.rpc import rpc_init
rpc = await rpc_init( cfg, proto )
rpc = await rpc_init(cfg)
height = await rpc.call('getblockcount')
Msg(f'{proto.coin} {proto.network.upper()} [height {height}]')
@ -156,13 +159,11 @@ async def main(req_addrs):
(do_output_tabular if cfg.tabular else do_output)( proto, addr_data, dict(zip(blk_heights,blk_hdrs)) )
cfg = opts.init(opts_data,init_opts={'rpc_backend':'aiohttp'})
cfg = Config( opts_data=opts_data, init_opts={'rpc_backend':'aiohttp'} )
if len(cfg._args) < 1:
die(1,'This command requires at least one coin address argument')
from mmgen.obj import CoinTxID,Int
try:
async_run(main(cfg._args))
except KeyboardInterrupt:

View file

@ -20,8 +20,7 @@
mmnode-blocks-info: Display information about a block or range of blocks
"""
import mmgen.opts as opts
from mmgen.globalvars import gc
from mmgen.cfg import gc,Config
from mmgen.util import async_run,fmt_list
from .BlocksInfo import BlocksInfo,JSONBlocksInfo
@ -157,7 +156,7 @@ This program requires a txindex-enabled daemon for correct operation.
}
}
cfg = opts.init(opts_data)
cfg = Config(opts_data=opts_data)
async def main():
@ -165,7 +164,7 @@ async def main():
cls = JSONBlocksInfo if cfg.json else BlocksInfo
m = cls( cfg, cfg._args, await rpc_init(cfg,cfg._proto) )
m = cls( cfg, cfg._args, await rpc_init(cfg) )
if m.fnames and not cfg.no_header:
m.print_header()

View file

@ -20,7 +20,8 @@
mmnode-feeview: Visualize the fee structure of a nodes mempool
"""
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import async_run,die,fmt,make_timestr,check_int_between
from mmgen.util2 import int2bytespec,parse_bytespec
min_prec,max_prec,dfl_prec = (0,6,4)
@ -39,7 +40,7 @@ fee_brackets = [
100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 2100000000000000,
]
cfg = opts.init({
opts_data = {
'sets': [
('detail',True,'ranges',True),
('detail',True,'show_mb_col',True),
@ -75,8 +76,10 @@ Note that there is no global mempool in Bitcoin, and your node’s mempool may
differ significantly from those of mining nodes depending on uptime and other
factors.
"""
}
}
})
cfg = Config(opts_data=opts_data)
if cfg.ignore_below:
if cfg.show_empty:
@ -202,7 +205,7 @@ async def main():
proto = cfg._proto
from mmgen.rpc import rpc_init
c = await rpc_init( cfg, proto )
c = await rpc_init(cfg)
mempool = await c.call('getrawmempool',True)

View file

@ -22,11 +22,13 @@ mmnode-halving-calculator: Estimate date(s) of future block subsidy halving(s)
import time
from decimal import Decimal
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import async_run
bdr_proj = 9.95
cfg = opts.init({
opts_data = {
'sets': [('mined',True,'list',True)],
'text': {
'desc': 'Estimate date(s) of future block subsidy halving(s)',
@ -41,7 +43,9 @@ cfg = opts.init({
-s, --sample-size=N Block range to calculate block discovery interval for next
halving estimate (default: dynamically calculated)
""" }
})
}
cfg = Config(opts_data=opts_data)
if cfg.bdr_proj:
bdr_proj = float(cfg.bdr_proj)

View file

@ -20,8 +20,10 @@
mmnode-netrate: Bitcoin daemon network rate monitor
"""
import time
from mmgen.common import *
import sys,time
from mmgen.cfg import Config
from mmgen.util import async_run
opts_data = {
'text': {
@ -34,14 +36,14 @@ opts_data = {
}
}
cfg = opts.init(opts_data)
cfg = Config(opts_data=opts_data)
ERASE_LINE,CUR_UP = '\033[K','\033[1A'
async def main():
from mmgen.rpc import rpc_init
c = await rpc_init( cfg, cfg._proto )
c = await rpc_init(cfg)
async def get_data():
d = await c.call('getnettotals')

View file

@ -20,9 +20,6 @@
mmnode-peerblocks: List blocks in flight, disconnect stalling nodes
"""
import mmgen.opts as opts
from mmgen.util import async_run
opts_data = {
'text': {
'desc': 'List blocks in flight, disconnect stalling nodes',
@ -36,10 +33,11 @@ opts_data = {
async def main():
cfg = opts.init(opts_data)
from mmgen.cfg import Config
cfg = Config(opts_data=opts_data)
from mmgen.rpc import rpc_init
rpc = await rpc_init( cfg, cfg._proto )
rpc = await rpc_init(cfg)
from .PeerBlocks import BlocksDisplay,PeersDisplay
blocks = BlocksDisplay(cfg)
@ -49,4 +47,5 @@ async def main():
await blocks.run(rpc)
await peers.run(rpc)
from mmgen.util import async_run
async_run(main())

View file

@ -13,7 +13,6 @@ mmnode-ticker: Display price information for cryptocurrency and other assets
"""
import sys,os
from mmgen.common import *
from .Ticker import *
opts_data = {
@ -197,7 +196,8 @@ To add a portfolio, edit the file
}
}
gcfg = opts.init(opts_data,do_post_init=True)
from mmgen.cfg import Config
gcfg = Config( opts_data=opts_data, do_post_init=True )
import mmgen_node_tools.Ticker as Ticker
Ticker.gcfg = gcfg
@ -206,6 +206,6 @@ cfg_in = get_cfg_in()
cfg = make_cfg(gcfg._args,cfg_in)
opts.post_init(gcfg)
gcfg._post_init()
main(cfg,cfg_in)

View file

@ -20,7 +20,8 @@
mmnode-txfind: Find a transaction in the blockchain or mempool
"""
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import msg,Msg,die
opts_data = {
'text': {
@ -62,7 +63,7 @@ async def main(txid):
msg(f'TxID: {txid}')
from mmgen.rpc import rpc_init
c = await rpc_init(cfg._proto)
c = await rpc_init(cfg)
exitval = 0
try:
@ -82,7 +83,7 @@ async def main(txid):
return exitval
cfg = opts.init(opts_data)
cfg = Config(opts_data=opts_data)
msgs = msg_data['quiet' if cfg.quiet else 'normal']

View file

@ -23,7 +23,7 @@ python_requires = >=3.7
include_package_data = True
install_requires =
mmgen>=13.3.dev43
mmgen>=13.3.dev44
packages =
mmgen_node_tools