cmdtest.py rune, runeswap: make txid mismatches into warnings
This commit is contained in:
parent
dc3df437ab
commit
8d314c6abe
5 changed files with 18 additions and 5 deletions
|
|
@ -77,6 +77,7 @@ class SwapCfgValueError(Exception): mmcode = 2
|
|||
# 3: yellow hl, 'MMGen Error' + exception + message
|
||||
class RPCFailure(Exception): mmcode = 3
|
||||
class RPCChainMismatch(Exception): mmcode = 3
|
||||
class TxIDMismatch(Exception): mmcode = 3
|
||||
class BadTxSizeEstimate(Exception): mmcode = 3
|
||||
class MaxInputSizeExceeded(Exception): mmcode = 3
|
||||
class MaxFileSizeExceeded(Exception): mmcode = 3
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class OnlineSigned(Signed):
|
|||
await asyncio.sleep(1)
|
||||
ret = await self.send_with_node(txhex)
|
||||
msg(f'Transaction sent: {coin_txid.hl()}')
|
||||
assert ret == coin_txid, f'txid mismatch (after sending) ({ret} != {coin_txid})'
|
||||
if ret != coin_txid:
|
||||
die('TxIDMismatch', f'txid mismatch (after sending) ({ret} != {coin_txid})')
|
||||
sent_status = 'no_confirm_post_send'
|
||||
|
||||
if cfg.wait and sent_status:
|
||||
|
|
|
|||
|
|
@ -136,14 +136,18 @@ class CmdTestRune(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
t.expect('can be sent')
|
||||
else:
|
||||
t.expect('to confirm: ', 'YES\n')
|
||||
t.written_to_file('Sent transaction')
|
||||
t.expect('Transaction sent: ')
|
||||
if t.expect(['written to file', 'txid mismatch']):
|
||||
self.tr.warn('txid mismatch')
|
||||
return 'ok'
|
||||
return t
|
||||
|
||||
def txhex1(self):
|
||||
t = self._txsend(add_opts=[f'--dump-hex={self.txhex_file}'], dump_hex=True)
|
||||
t.read()
|
||||
txhex = get_data_from_file(self.cfg, self.txhex_file, silent=True)
|
||||
assert md5(txhex.encode()).hexdigest()[:8] == self.txhex_chksum
|
||||
if md5(txhex.encode()).hexdigest()[:8] != self.txhex_chksum:
|
||||
self.tr.warn('txid mismatch')
|
||||
return t
|
||||
|
||||
def rpc_server_stop(self):
|
||||
|
|
|
|||
|
|
@ -119,7 +119,11 @@ class CmdTestRuneSwapRune(CmdTestSwapMethods, CmdTestRune):
|
|||
return self._swaptxsign()
|
||||
|
||||
def swaptxsend1(self):
|
||||
return self._swaptxsend(add_opts=[f'--proxy=localhost:{TestProxy.port}'])
|
||||
t = self._swaptxsend(add_opts=[f'--proxy=localhost:{TestProxy.port}'])
|
||||
if t.expect(['written to file', 'txid mismatch']):
|
||||
self.tr.parent_group.tr.warn('txid mismatch')
|
||||
return 'ok'
|
||||
return t
|
||||
|
||||
def swaptxstatus1(self):
|
||||
return self._swaptxsend(add_opts=['--verbose', '--status'], status=True)
|
||||
|
|
@ -131,5 +135,7 @@ class CmdTestRuneSwapRune(CmdTestSwapMethods, CmdTestRune):
|
|||
t = self._swaptxsend(add_opts=[f'--dump-hex={self.txhex_file}'], dump_hex=True)
|
||||
t.read()
|
||||
txhex = get_data_from_file(self.cfg, self.txhex_file, silent=True)
|
||||
assert md5(txhex.encode()).hexdigest()[:8] == self.txhex_chksum
|
||||
if md5(txhex.encode()).hexdigest()[:8] != self.txhex_chksum:
|
||||
self.tr.parent_group.tr.warn('txid mismatch')
|
||||
return 'ok'
|
||||
return t
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ class CmdTestSwapMethods:
|
|||
t = trunner
|
||||
ret = CmdTestRunner(cfg, t.repo_root, t.data_dir, t.trash_dir, t.trash_dir2)
|
||||
ret.init_group(self.cross_group)
|
||||
ret.parent_group = self
|
||||
return ret
|
||||
|
||||
class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue