tx.new, cmdtest.py: minor cleanups
This commit is contained in:
parent
ccdb8295cd
commit
32af0c4a0b
3 changed files with 33 additions and 18 deletions
|
|
@ -262,6 +262,8 @@ class New(Base):
|
|||
is_chg = not a.amt,
|
||||
is_vault = a.is_vault)
|
||||
|
||||
self.check_dup_addrs('outputs')
|
||||
|
||||
if self.is_compat:
|
||||
return
|
||||
|
||||
|
|
@ -281,8 +283,6 @@ class New(Base):
|
|||
|
||||
self.add_mmaddrs_to_outputs(ad_f, ad_w)
|
||||
|
||||
self.check_dup_addrs('outputs')
|
||||
|
||||
if self.chg_output is not None:
|
||||
if self.chg_autoselected and not self.is_swap: # swap TX, so user has already confirmed
|
||||
self.confirm_autoselected_addr(
|
||||
|
|
@ -470,8 +470,6 @@ class New(Base):
|
|||
|
||||
assert isinstance(locktime, int | type(None)), 'locktime must be of type int'
|
||||
|
||||
from ..tw.unspent import TwUnspentOutputs
|
||||
|
||||
if self.cfg.comment_file:
|
||||
self.add_comment(infile=self.cfg.comment_file)
|
||||
|
||||
|
|
@ -493,6 +491,7 @@ class New(Base):
|
|||
await TwAddrData(self.cfg, self.proto, twctl=self.twctl))
|
||||
|
||||
if not self.is_bump:
|
||||
from ..tw.unspent import TwUnspentOutputs
|
||||
self.twuo = await TwUnspentOutputs(
|
||||
self.cfg,
|
||||
self.proto,
|
||||
|
|
|
|||
|
|
@ -879,7 +879,8 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|||
sweep_type = None,
|
||||
sweep_menu = '',
|
||||
signable_desc = 'transaction',
|
||||
expect_str = None):
|
||||
expect_str = None,
|
||||
exit_val = 0):
|
||||
if wait_signed:
|
||||
self._wait_signed(signable_desc)
|
||||
self.insert_device_online()
|
||||
|
|
@ -888,8 +889,11 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|||
(opts or self.user_opts)
|
||||
+ self.autosign_opts
|
||||
+ add_opts
|
||||
+ args)
|
||||
if '--abort' in opts:
|
||||
+ args,
|
||||
exit_val = exit_val)
|
||||
if exit_val:
|
||||
pass
|
||||
elif '--abort' in opts:
|
||||
t.expect('(y/N): ', 'y')
|
||||
elif op == 'txcreate':
|
||||
if sweep_type:
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ class CmdTestXMRSwapMethods:
|
|||
inputs,
|
||||
auto_chg_addr = None,
|
||||
auto_dest_addr = None,
|
||||
expect_pats = None):
|
||||
expect_pats = None,
|
||||
exit_val = 0):
|
||||
return self._user_txcreate(
|
||||
'bob',
|
||||
progname = 'swaptxcreate',
|
||||
|
|
@ -81,6 +82,7 @@ class CmdTestXMRSwapMethods:
|
|||
'auto_chg_addr': auto_chg_addr,
|
||||
'auto_dest_addr': auto_dest_addr,
|
||||
'expect_pats': expect_pats},
|
||||
exit_val = exit_val,
|
||||
output_args = args)
|
||||
|
||||
def _swaptxcreate_refnum(
|
||||
|
|
@ -93,12 +95,14 @@ class CmdTestXMRSwapMethods:
|
|||
auto_chg_addr = None,
|
||||
auto_dest_addr = None,
|
||||
prompt = None,
|
||||
expect_pats = None):
|
||||
expect_pats = None,
|
||||
exit_val = 0):
|
||||
data = json.loads(self.read_from_tmpfile('memo_info.json'))
|
||||
return self._user_txcreate(
|
||||
'bob',
|
||||
progname = 'swaptxcreate',
|
||||
opts = ['--monero-wallet-rpc-password=abc', f'--refnum={data["reference"]}'] + add_opts,
|
||||
exit_val = exit_val,
|
||||
ui_handler = self._swaptxcreate_ui,
|
||||
ui_handler_args = {
|
||||
'prompt': prompt or self.menu_prompt,
|
||||
|
|
@ -205,13 +209,13 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
('bob_bal2', 'Bob’s balance')),
|
||||
'xmr_swap': (
|
||||
'swap operations (XMR -> LTC)',
|
||||
('remote_get_refnum_xmr', 'getting the reference number'),
|
||||
('swaptxcreate_refreq7', 'creating an XMR->LTC registration transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refreq7', 'sending the transaction'),
|
||||
('swaptxcreate_refnum7', 'creating an XMR->LTC swap transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refnum7', 'sending the transaction'),
|
||||
('xmr_mine_blocks_10', ''),
|
||||
('swaptxstatus_refnum7', 'getting the transaction status'))}
|
||||
('remote_get_refnum_xmr', 'getting the reference number'),
|
||||
('swaptxcreate_refreq7', 'creating an XMR->LTC registration transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refreq7', 'sending the transaction'),
|
||||
('swaptxcreate_refnum7', 'creating an XMR->LTC swap transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refnum7', 'sending the transaction'),
|
||||
('xmr_mine_blocks_10', ''),
|
||||
('swaptxstatus_refnum7', 'getting the transaction status'))}
|
||||
|
||||
exec(create_cross_methods(cross_coin, cross_group, cmd_group_in, cmd_subgroups))
|
||||
|
||||
|
|
@ -306,9 +310,13 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
return self._remote_get_refnum(self.refreq_txid_xmr)
|
||||
|
||||
def swaptxcreate_refreq7(self):
|
||||
return self._swaptxcreate_refreq_xmr(['XMR', '0.2345', 'LTC'])
|
||||
|
||||
def _swaptxcreate_refreq_xmr(self, args, *, exit_val=0):
|
||||
return self._swaptxcreate_refreq(
|
||||
args = ['XMR', '0.2345', 'LTC'],
|
||||
args = args,
|
||||
inputs = '3',
|
||||
exit_val = exit_val,
|
||||
auto_dest_addr = '98831F3A:B:3',
|
||||
expect_pats = ['rltc1q6rs4znw8k', r'to spend:.*\b0\b.*RUNE'])
|
||||
|
||||
|
|
@ -316,12 +324,16 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
return self._user_txsend('bob', need_rbf=True)
|
||||
|
||||
def swaptxcreate_refnum7(self):
|
||||
return self._swaptxcreate_refnum_xmr(['XMR', '0.2345', 'LTC'])
|
||||
|
||||
def _swaptxcreate_refnum_xmr(self, args, *, exit_val=0):
|
||||
return self._swaptxcreate_refnum(
|
||||
add_opts = ['--priority=3'],
|
||||
args = ['XMR', '0.2345', 'LTC'],
|
||||
args = args,
|
||||
inputs = '1',
|
||||
tx_type = 'xmr_swap',
|
||||
prompt = self.xmr_prompt,
|
||||
exit_val = exit_val,
|
||||
auto_dest_addr = '98831F3A:B:3',
|
||||
expect_pats = [r'Amount:.*0.234499978787', r'Priority:.*high'])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue