minor fixes

This commit is contained in:
The MMGen Project 2019-05-20 15:43:01 +00:00
commit e879b7e548
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 44 additions and 13 deletions

View file

@ -22,6 +22,7 @@ mmgen-txbump: Increase the fee on a replaceable (replace-by-fee) MMGen
"""
from mmgen.common import *
from mmgen.seed import SeedSource
opts_data = {
'sets': [('yes', True, 'quiet', True)],
@ -71,7 +72,13 @@ opts_data = {
-y, --yes Answer 'yes' to prompts, suppress non-essential output
-z, --show-hash-presets Show information on available hash presets
""",
'notes': '\n{}{}'
'notes': """
{}{}
Seed source files must have the canonical extensions listed in the 'FileExt'
column below:
{f}
"""
},
'code': {
'options': lambda s: s.format(
@ -82,7 +89,8 @@ opts_data = {
cu=g.coin),
'notes': lambda s: s.format(
help_notes('fee'),
help_notes('txsign'))
help_notes('txsign'),
f='\n '.join(SeedSource.format_fmt_codes().splitlines()))
}
}

View file

@ -21,6 +21,7 @@ mmgen-txdo: Create, sign and broadcast an online MMGen transaction
"""
from mmgen.common import *
from mmgen.seed import SeedSource
from mmgen.obj import SubSeedIdxRange
opts_data = {
@ -80,7 +81,13 @@ opts_data = {
-y, --yes Answer 'yes' to prompts, suppress non-essential output
-z, --show-hash-presets Show information on available hash presets
""",
'notes': '\n{}{}{}',
'notes': """
{}{}{}
Seed source files must have the canonical extensions listed in the 'FileExt'
column below:
{f}
"""
},
'code': {
'options': lambda s: s.format(
@ -94,7 +101,8 @@ opts_data = {
'notes': lambda s: s.format(
help_notes('txcreate'),
help_notes('fee'),
help_notes('txsign'))
help_notes('txsign'),
f='\n '.join(SeedSource.format_fmt_codes().splitlines()))
}
}

View file

@ -168,7 +168,7 @@ def match_error(sec,wif,a_addr,b_addr,a,b):
def compare_test():
for k in ('segwit','compressed'):
if addr_type.name == k and g.coin not in ci.external_tests_segwit_compressed[k]:
if b == 'ext' and addr_type.name == k and g.coin not in ci.external_tests_segwit_compressed[k]:
m = 'skipping - external program does not support {} for coin {}'
msg(m.format(addr_type.name.capitalize(),g.coin))
return
@ -178,7 +178,12 @@ def compare_test():
return
m = "Comparing address generators '{}' and '{}' for coin {}"
last_t = time.time()
qmsg(green(m.format(kg_a.desc,(ext_lib if b == 'ext' else kg_b.desc),g.coin)))
A = kg_a.desc
B = ext_lib if b == 'ext' else kg_b.desc
if A == B:
msg('skipping - generation methods A and B are the same ({})'.format(A))
return
qmsg(green(m.format(A,B,g.coin)))
for i in range(rounds):
if opt.verbose or time.time() - last_t >= 0.1:

View file

@ -54,7 +54,7 @@ class TestSuiteAutosign(TestSuiteBase):
txcount=12,
live=False):
if self.skip_for_win(): return
if self.skip_for_win(): return 'skip'
def make_wallet(opts):
t = self.spawn('mmgen-autosign',opts+['gen_key'],extra_desc='(gen_key)')

View file

@ -142,7 +142,8 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
)
def __init__(self,trunner,cfgs,spawn):
self.lbl_id = ('account','label')[g.coin=='BTC'] # update as other coins adopt Core's label API
rpc_init()
self.lbl_id = ('account','label')['label_api' in g.rpch.caps]
if g.coin in ('BTC','BCH','LTC'):
self.tx_fee = {'btc':'0.0001','bch':'0.001','ltc':'0.01'}[g.coin.lower()]
self.txbump_fee = {'btc':'123s','bch':'567s','ltc':'12345s'}[g.coin.lower()]

View file

@ -57,11 +57,20 @@ class tx_deserialize(object):
# outputs
a,b = d['vout'],dt['txouts']
for i in range(len(a)):
assert a[i]['scriptPubKey']['addresses'][0] == b[i]['address'],(
'address of ouput {} does not match'.format(i))
assert a[i]['value'] == b[i]['amount'],'value of ouput {} does not match'.format(i)
assert a[i]['scriptPubKey']['hex'] == b[i]['scriptPubKey'],(
'scriptPubKey of ouput {} does not match'.format(i))
A = a[i]['scriptPubKey']['addresses'][0]
B = b[i]['address']
fs = 'address of output {} does not match\nA: {}\nB: {}'
assert A == B, fs.format(i,A,B)
A = a[i]['value']
B = b[i]['amount']
fs = 'value of output {} does not match\nA: {}\nB: {}'
assert A == B, fs.format(i,A,B)
A = a[i]['scriptPubKey']['hex']
B = b[i]['scriptPubKey']
fs = 'scriptPubKey of output {} does not match\nA: {}\nB: {}'
assert A == B, fs.format(i,A,B)
return True