mmgen-xmrwallet: new abort operation
This commit is contained in:
parent
67e8802102
commit
986e1ebf72
4 changed files with 38 additions and 7 deletions
|
|
@ -53,6 +53,8 @@ relay - relay a transaction from a transaction file created using ‘sweep
|
|||
submit - submit an autosigned transaction to a wallet and the network
|
||||
resubmit - resubmit most recently submitted autosigned transaction (other
|
||||
actions are required: see Exporting Outputs below)
|
||||
abort - abort the current transaction created with --autosign. The
|
||||
transaction may be signed or unsigned
|
||||
txview - display detailed information about a transaction file or files
|
||||
txlist - same as above, but display terse information in tabular format
|
||||
dump - produce JSON dumps of wallet metadata (accounts, addresses and
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ opts_data = {
|
|||
'[opts] sweep [xmr_keyaddrfile] SWEEP_SPEC',
|
||||
'[opts] submit [TX_file]',
|
||||
'[opts] relay <TX_file>',
|
||||
'[opts] resubmit',
|
||||
'[opts] resubmit | abort (for use with --autosign only)',
|
||||
'[opts] txview | txlist [TX_file] ...',
|
||||
'[opts] export-outputs [wallets]',
|
||||
'[opts] import-key-images [wallets]',
|
||||
|
|
@ -110,7 +110,7 @@ if cmd_args and cfg.autosign and (
|
|||
MoneroWalletOps.kafile_arg_ops
|
||||
+ ('export-outputs','import-key-images','txview','txlist')
|
||||
)
|
||||
or len(cmd_args) == 1 and cmd_args[0] in ('submit','resubmit')
|
||||
or len(cmd_args) == 1 and cmd_args[0] in ('submit', 'resubmit', 'abort')
|
||||
):
|
||||
cmd_args.insert(1,None)
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ op = cmd_args.pop(0)
|
|||
infile = cmd_args.pop(0)
|
||||
wallets = spec = None
|
||||
|
||||
if op in ('relay','submit','resubmit'):
|
||||
if op in ('relay', 'submit', 'resubmit', 'abort'):
|
||||
if len(cmd_args) != 0:
|
||||
cfg._opts.usage()
|
||||
elif op in ('txview','txlist'):
|
||||
|
|
|
|||
|
|
@ -629,6 +629,7 @@ class MoneroWalletOps:
|
|||
'sign',
|
||||
'submit',
|
||||
'resubmit',
|
||||
'abort',
|
||||
'dump',
|
||||
'restore',
|
||||
'export_outputs',
|
||||
|
|
@ -1854,6 +1855,15 @@ class MoneroWalletOps:
|
|||
key = lambda x: getattr(x.data,'submit_time',None) or x.data.create_time
|
||||
)[-1]
|
||||
|
||||
class abort(base):
|
||||
opts = ('watch_only','autosign')
|
||||
|
||||
def __init__(self, cfg, uarg_tuple):
|
||||
super().__init__(cfg,uarg_tuple)
|
||||
self.mount_removable_device()
|
||||
from .autosign import Signable
|
||||
Signable.xmr_transaction(self.asi).shred_abortable() # prompts user, then raises exception or exits
|
||||
|
||||
class dump(wallet):
|
||||
wallet_offline = True
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@ class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignThreaded):
|
|||
('export_outputs1', 'exporting outputs from Alice’s watch-only wallet #1'),
|
||||
('import_key_images1', 'importing signed key images into Alice’s online wallets'),
|
||||
('sync_chkbal1', 'syncing Alice’s wallet #1'),
|
||||
('abort_tx1', 'aborting the current transaction (error)'),
|
||||
('create_transfer_tx2', 'creating a transfer TX (for relaying via proxy)'),
|
||||
('abort_tx2', 'aborting the current transaction (OK, unsigned)'),
|
||||
('create_transfer_tx2a', 'creating the transfer TX again'),
|
||||
('submit_transfer_tx2', 'submitting the transfer TX (relaying via proxy)'),
|
||||
('sync_chkbal2', 'syncing Alice’s wallets and checking balance'),
|
||||
('dump_wallets', 'dumping Alice’s wallets'),
|
||||
|
|
@ -248,12 +251,28 @@ class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignThreaded):
|
|||
return self._create_transfer_tx('0.124')
|
||||
|
||||
def create_transfer_tx2(self):
|
||||
self.do_mount_online()
|
||||
get_file_with_ext(self.asi_online.xmr_tx_dir,'rawtx',delete_all=True)
|
||||
get_file_with_ext(self.asi_online.xmr_tx_dir,'sigtx',delete_all=True)
|
||||
self.do_umount_online()
|
||||
return self._create_transfer_tx('0.257')
|
||||
|
||||
create_transfer_tx2a = create_transfer_tx2
|
||||
|
||||
def _abort_tx(self,expect,send=None,exit_val=None):
|
||||
self.insert_device_online()
|
||||
t = self.spawn('mmgen-xmrwallet', ['--autosign', 'abort'])
|
||||
t.expect(expect)
|
||||
if send:
|
||||
t.send(send)
|
||||
t.read() # required!
|
||||
self.remove_device_online()
|
||||
if exit_val:
|
||||
t.req_exit_val = exit_val
|
||||
return t
|
||||
|
||||
def abort_tx1(self):
|
||||
return self._abort_tx('No unsent transactions present', exit_val=2)
|
||||
|
||||
def abort_tx2(self):
|
||||
return self._abort_tx('(y/N): ', 'y')
|
||||
|
||||
def _xmr_autosign_op(
|
||||
self,
|
||||
op,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue