minor fixes and cleanups
This commit is contained in:
parent
967fad0b14
commit
0d38b62081
8 changed files with 33 additions and 26 deletions
|
|
@ -24,7 +24,7 @@ class help_notes:
|
|||
return (
|
||||
'COIN1 [AMT CHG_ADDR] COIN2 [ADDR]'
|
||||
if target == 'swaptx' else
|
||||
'[ADDR,AMT ... | DATA_SPEC] ADDR <change addr, addrlist ID or addr type>'
|
||||
'[ADDR,AMT ... | DATA_SPEC] ADDR'
|
||||
if self.proto.base_proto == 'Bitcoin' else
|
||||
'ADDR,AMT')
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ opts_data = {
|
|||
'filter_codes': ['-'],
|
||||
'sets': [('yes', True, 'quiet', True)],
|
||||
'text': {
|
||||
'desc': f"""
|
||||
'desc': """
|
||||
Create, and optionally send and sign, a replacement transaction
|
||||
on networks that support replace-by-fee (RBF)
|
||||
""",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Bump(Completed, New):
|
|||
|
||||
# If sending, require original tx to be sent
|
||||
if check_sent and not self.coin_txid:
|
||||
die(1, 'Transaction {self.txid!r} was not broadcast to the network')
|
||||
die(1, f'Transaction {self.txid!r} was not broadcast to the network')
|
||||
|
||||
self.coin_txid = ''
|
||||
self.sent_timestamp = None
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ class NewSwap(New):
|
|||
desc = 'swap transaction'
|
||||
is_swap = True
|
||||
|
||||
async def process_swap_cmdline_args(self, cmd_args, addrfile_args):
|
||||
async def process_swap_cmdline_args(self, cmd_args, addrfiles):
|
||||
raise NotImplementedError(f'Swap not implemented for protocol {self.proto.__name__}')
|
||||
|
|
|
|||
|
|
@ -78,7 +78,10 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
|
||||
self.opts.append('--alice')
|
||||
|
||||
def _alice_txcreate(self, chg_addr, opts=[], exit_val=0, expect_str=None, data_arg=None):
|
||||
def _alice_txcreate(self, chg_addr, opts=[], exit_val=0, expect_str=None, data_arg=None, need_rbf=False):
|
||||
|
||||
if need_rbf and not self.proto.cap('rbf'):
|
||||
return 'skip'
|
||||
|
||||
def do_return():
|
||||
if expect_str:
|
||||
|
|
@ -120,9 +123,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
alice_txcreate3 = alice_txcreate2
|
||||
|
||||
def alice_txcreate4(self):
|
||||
if cfg.coin == 'BCH':
|
||||
return 'skip'
|
||||
return self._alice_txcreate(chg_addr='L:4')
|
||||
return self._alice_txcreate(chg_addr='L:4', need_rbf=True)
|
||||
|
||||
def _alice_txsend_abort(self, err=False, send_resp='y', expect=None, shred_expect=[]):
|
||||
self.insert_device_online()
|
||||
|
|
@ -170,16 +171,16 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
return self._alice_txsend('This one’s worth a comment', no_wait=True)
|
||||
|
||||
def alice_txsend2(self):
|
||||
if cfg.coin == 'BCH':
|
||||
return 'skip'
|
||||
return self._alice_txsend()
|
||||
return self._alice_txsend(need_rbf=True)
|
||||
|
||||
def alice_txsend3(self):
|
||||
if cfg.coin == 'BCH':
|
||||
return 'skip'
|
||||
return self._alice_txsend()
|
||||
return self._alice_txsend(need_rbf=True)
|
||||
|
||||
def _alice_txstatus(self, expect, exit_val=None, need_rbf=False):
|
||||
|
||||
if need_rbf and not self.proto.cap('rbf'):
|
||||
return 'skip'
|
||||
|
||||
def _alice_txstatus(self, expect, exit_val=None):
|
||||
self.insert_device_online()
|
||||
t = self.spawn(
|
||||
'mmgen-txsend',
|
||||
|
|
@ -203,7 +204,11 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
def alice_txstatus4(self):
|
||||
return self._alice_txstatus('1 confirmation', 0)
|
||||
|
||||
def _alice_txsend(self, comment=None, no_wait=False):
|
||||
def _alice_txsend(self, comment=None, no_wait=False, need_rbf=False):
|
||||
|
||||
if need_rbf and not self.proto.cap('rbf'):
|
||||
return 'skip'
|
||||
|
||||
if not no_wait:
|
||||
self._wait_signed('transaction')
|
||||
self.insert_device_online()
|
||||
|
|
@ -224,18 +229,18 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
self.remove_device_online()
|
||||
return t
|
||||
|
||||
def _alice_txbump(self, bad_tx_desc=None):
|
||||
def _alice_txbump(self, bad_tx_expect=None):
|
||||
if cfg.coin == 'BCH':
|
||||
return 'skip'
|
||||
self.insert_device_online()
|
||||
t = self.spawn(
|
||||
'mmgen-txbump',
|
||||
['--alice', '--autosign'],
|
||||
exit_val = 1 if bad_tx_desc else None)
|
||||
if bad_tx_desc:
|
||||
exit_val = 1 if bad_tx_expect else None)
|
||||
if bad_tx_expect:
|
||||
time.sleep(0.5)
|
||||
t.expect('Only sent transactions')
|
||||
t.expect(bad_tx_desc)
|
||||
t.expect(bad_tx_expect)
|
||||
else:
|
||||
t.expect(r'to deduct the fee from .* change output\): ', '\n', regex=True)
|
||||
t.expect(r'(Y/n): ', 'y') # output OK?
|
||||
|
|
@ -248,11 +253,11 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
return t
|
||||
|
||||
def alice_txbump1(self):
|
||||
return self._alice_txbump(bad_tx_desc='unsigned transaction')
|
||||
return self._alice_txbump(bad_tx_expect='unsigned transaction')
|
||||
|
||||
def alice_txbump2(self):
|
||||
self._wait_signed('transaction')
|
||||
return self._alice_txbump(bad_tx_desc='unsent transaction')
|
||||
return self._alice_txbump(bad_tx_expect='unsent transaction')
|
||||
|
||||
def alice_txbump3(self):
|
||||
return self._alice_txbump()
|
||||
|
|
|
|||
|
|
@ -1058,7 +1058,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared):
|
|||
return self.txbump(
|
||||
f7,
|
||||
prepend_args = ['-p1', '-k', non_mm_file, '-M', f1],
|
||||
seed_args = [f2, f3, f4, f5, f6, f8])
|
||||
seed_args = [f2, f3, f4, f6, f8])
|
||||
|
||||
def walletgen5(self, del_dw_run='dummy'):
|
||||
return self.walletgen()
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ from .common import (
|
|||
tw_comment_lat_cyr_gr,
|
||||
tw_comment_zh,
|
||||
tx_comment_jp,
|
||||
get_env_without_debug_vars)
|
||||
get_env_without_debug_vars,
|
||||
rt_pw)
|
||||
|
||||
from .ct_base import CmdTestBase
|
||||
from .ct_shared import CmdTestShared
|
||||
|
|
@ -66,7 +67,6 @@ dfl_wcls = get_wallet_cls('mmgen')
|
|||
|
||||
tx_fee = rtFundAmt = rtFee = rtBals = rtBals_gb = rtBobOp3 = rtAmts = None # ruff
|
||||
|
||||
rt_pw = 'abc-α'
|
||||
rt_data = {
|
||||
'tx_fee': {'btc':'0.0001', 'bch':'0.001', 'ltc':'0.01'},
|
||||
'rtFundAmt': {'btc':'500', 'bch':'500', 'ltc':'5500'},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ test.cmdtest_d.ct_swap: asset swap tests for the cmdtest.py test suite
|
|||
|
||||
from mmgen.protocol import init_proto
|
||||
|
||||
from ..include.common import gr_uc
|
||||
|
||||
from .ct_regtest import (
|
||||
CmdTestRegtest,
|
||||
rt_data,
|
||||
|
|
@ -21,7 +23,7 @@ from .ct_regtest import (
|
|||
rt_pw,
|
||||
cfg)
|
||||
|
||||
sample1 = '=:ETH.ETH:0x86d526d6624AbC0178cF7296cD538Ecc080A95F1:0/1/0'
|
||||
sample1 = gr_uc[:24]
|
||||
sample2 = '00010203040506'
|
||||
|
||||
class CmdTestSwap(CmdTestRegtest):
|
||||
|
|
@ -53,7 +55,7 @@ class CmdTestSwap(CmdTestRegtest):
|
|||
),
|
||||
'data': (
|
||||
'OP_RETURN data operations',
|
||||
('data_tx1_create', 'Creating a transaction with OP_RETURN data (hex-encoded ascii)'),
|
||||
('data_tx1_create', 'Creating a transaction with OP_RETURN data (hex-encoded UTF-8)'),
|
||||
('data_tx1_sign', 'Signing the transaction'),
|
||||
('data_tx1_send', 'Sending the transaction'),
|
||||
('data_tx1_chk', 'Checking the sent transaction'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue