Browse Source

minor fixes and cleanups

The MMGen Project 1 year ago
parent
commit
eecf8acd0d

+ 1 - 0
mmgen_node_tools/PeerBlocks.py

@@ -31,6 +31,7 @@ class Display(PollDisplay):
 	poll_secs = 2
 
 	def __init__(self):
+
 		super().__init__()
 
 		global term,term_width

+ 1 - 0
mmgen_node_tools/main_txfind.py

@@ -86,6 +86,7 @@ async def main(txid):
 	return exitval
 
 cmd_args = opts.init(opts_data)
+
 msgs = msg_data['quiet' if opt.quiet else 'normal']
 
 if len(cmd_args) != 1:

+ 1 - 1
test/test_py_d/ts_misc.py

@@ -9,7 +9,7 @@
 #   https://gitlab.com/mmgen/mmgen-node-tools
 
 """
-ts_misc.py: Miscellaneous test groups for the test.py test suite
+test.test_py_d.ts_misc: Miscellaneous test groups for the test.py test suite
 """
 
 import shutil

+ 7 - 6
test/test_py_d/ts_regtest.py

@@ -9,7 +9,7 @@
 #   https://gitlab.com/mmgen/mmgen-node-tools
 
 """
-ts_regtest.py: Regtest tests for the test.py test suite
+test.test_py_d.ts_regtest: Regtest tests for the test.py test suite
 """
 
 import os
@@ -273,7 +273,7 @@ class TestSuiteRegtest(TestSuiteBase):
 			wp = namedtuple('wifaddrpair',['wif','addr'])
 
 			def gen():
-				for n in range(1,nPairs+1):
+				for n in range(0xfaceface,nPairs+0xfaceface):
 					wif = t.hex2wif(f'{n:064x}')
 					yield wp( wif, t.wif2addr(wif) )
 
@@ -299,11 +299,12 @@ class TestSuiteRegtest(TestSuiteBase):
 
 		async def do_tx1():
 			us = await r.rpc_call('listunspent',wallet='miner')
+			tx_input = us[7] # 25 BTC in coinbase -- us[0] could have < 25 BTC
 			fee = self.proto.coin_amt('0.001')
 			outputs = {p.addr:tx1_amt for p in pairs[:nTxs]}
-			outputs.update({burn_addr: us[0]['amount'] - (tx1_amt*nTxs) - fee})
+			outputs.update({burn_addr: tx_input['amount'] - (tx1_amt*nTxs) - fee})
 			return await do_tx(
-				[{ 'txid': us[0]['txid'], 'vout': 0 }],
+				[{ 'txid': tx_input['txid'], 'vout': 0 }],
 				outputs,
 				r.miner_wif )
 
@@ -326,8 +327,8 @@ class TestSuiteRegtest(TestSuiteBase):
 		r = self.regtest
 		nPairs = 100
 		nTxs = 25
-		tx1_amt = self.proto.coin_amt('{:0.4f}'.format(24 / (nTxs+1))) # 25 BTC subsidy
-		tx2_amt = self.proto.coin_amt('0.0001')
+		tx1_amt = self.proto.coin_amt('{:0.4f}'.format(24 / nTxs)) # 25 BTC subsidy, leave extra for fee
+		tx2_amt = self.proto.coin_amt('0.00005')                   # make this as small as possible
 
 		imsg(f'Creating {nPairs} key-address pairs')
 		pairs = create_pairs(nPairs+1)

+ 5 - 3
test/unit_tests_d/ut_BlocksInfo.py

@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 """
-test.unit_tests_d.nt_BlocksInfo:
-  BlocksInfo unit test for the MMGen Node Tools suite
+test.unit_tests_d.nt_BlocksInfo: BlocksInfo unit test for the MMGen Node Tools suite
 """
 
 from mmgen.common import *
@@ -108,7 +107,10 @@ class unit_tests:
 	def parse_cmd_args(self,name,ut):
 
 		def test(spec,foo,chk):
-			b = BlocksInfo(spec if type(spec) == tuple else [spec],dummyOpt(),dummyRPC())
+			b = BlocksInfo(
+				spec if type(spec) == tuple else [spec],
+				dummyOpt(),
+				dummyRPC() )
 			ret = (b.first,b.last,b.block_list)
 			vmsg('{:13} => {}'.format(
 				(repr(spec) if type(spec) == tuple else spec),