swap.proto.thorchain: increase streaming interval to 3
This commit is contained in:
parent
9400a558ba
commit
e26a242e54
5 changed files with 19 additions and 17 deletions
|
|
@ -26,7 +26,7 @@ class THORChainMemo:
|
|||
trade_limit = None
|
||||
|
||||
# Swap interval in blocks. Optional. If 0, do not stream
|
||||
stream_interval = 1
|
||||
stream_interval = 3
|
||||
|
||||
# Swap quantity. The interval value determines the frequency of swaps in blocks
|
||||
# Optional. If 0, network will determine the number of swaps
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ from collections import namedtuple
|
|||
|
||||
from ....amt import UniAmt
|
||||
|
||||
from . import Memo
|
||||
|
||||
_gd = namedtuple('gas_unit_data', ['code', 'disp'])
|
||||
gas_unit_data = {
|
||||
'satsperbyte': _gd('s', 'sat/byte'),
|
||||
|
|
@ -68,7 +70,7 @@ class Thornode:
|
|||
f'from_asset={send}&'
|
||||
f'to_asset={recv}&'
|
||||
f'amount={amt}&'
|
||||
'streaming_interval=1')
|
||||
f'streaming_interval={Memo.stream_interval}')
|
||||
data = json.loads(self.rpc.get(get_str).content)
|
||||
if not 'expiry' in data:
|
||||
from ....util import pp_fmt, die
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev
|
|||
self._swaptxcreate(
|
||||
['ETH', '8.765', 'BTC', f'{dfl_sid}:B:4'],
|
||||
add_opts = ['--trade-limit=3%']),
|
||||
expect = ':2019e4/1/0')
|
||||
expect = ':2019e4/3/0')
|
||||
|
||||
def swaptxcreate3a(self):
|
||||
t = self._swaptxcreate(['ETH', '0.7654321', 'ETH.MM1'])
|
||||
|
|
@ -434,7 +434,7 @@ class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev
|
|||
fn = self.get_file_with_ext('sigtx')
|
||||
tx = json.loads(get_data_from_file(self.cfg, fn, quiet=True).strip())
|
||||
txid = tx['MMGenTransaction']['coin_txid']
|
||||
chk = '=:ETH.MM1:0x48596c861c970eb4ca72c5082ff7fecd8ee5be9d:0/1/0' # E:5
|
||||
chk = '=:ETH.MM1:0x48596c861c970eb4ca72c5082ff7fecd8ee5be9d:0/3/0' # E:5
|
||||
imsg(f'TxID: {txid}\nmemo: {chk}')
|
||||
res = await (await self.rpc).call('eth_getTransactionByHash', '0x' + txid)
|
||||
chk_equal(bytes.fromhex(res['input'].removeprefix('0x')).decode(), chk)
|
||||
|
|
@ -467,7 +467,7 @@ class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev
|
|||
|
||||
def swaptxmemo4(self):
|
||||
self.mining_delay()
|
||||
return self._check_token_swaptx_memo('=:b:mkQsXA7mqDtnUpkaXMbDtAL1KMeof4GPw3:0/1/0')
|
||||
return self._check_token_swaptx_memo('=:b:mkQsXA7mqDtnUpkaXMbDtAL1KMeof4GPw3:0/3/0')
|
||||
|
||||
def swaptxreceipt4(self):
|
||||
return self._swaptxsend(add_opts=['--receipt'], spawn_only=True)
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
self._swaptxcreate(
|
||||
['BCH', '1.234', f'{self.sid}:C:{idx}', 'LTC', f'{self.sid}:B:3'],
|
||||
add_opts = ['--trade-limit=0%']),
|
||||
expect = ':3541e5/1/0')
|
||||
expect = ':3541e5/3/0')
|
||||
|
||||
def swaptxcreate2(self):
|
||||
t = self._swaptxcreate(
|
||||
|
|
@ -541,14 +541,14 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
add_opts = ['--no-quiet', '--trade-limit=3.337%'])
|
||||
t.expect('Enter a number> ', '1')
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
return self._swaptxcreate_ui_common(t, reload_quote=True, expect=':1386e6/1/0')
|
||||
return self._swaptxcreate_ui_common(t, reload_quote=True, expect=':1386e6/3/0')
|
||||
|
||||
def swaptxcreate3(self):
|
||||
return self._swaptxcreate_ui_common(
|
||||
self._swaptxcreate(
|
||||
['BCH', 'LTC', f'{self.sid}:B:3'],
|
||||
add_opts = ['--trade-limit=10.1%']),
|
||||
expect = ':1289e6/1/0')
|
||||
expect = ':1289e6/3/0')
|
||||
|
||||
def swaptxcreate4(self):
|
||||
t = self._swaptxcreate(
|
||||
|
|
@ -557,7 +557,7 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
t.expect('OK? (Y/n): ', 'y')
|
||||
t.expect('Enter a number> ', '1')
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
return self._swaptxcreate_ui_common(t, expect=':358e6/1/0')
|
||||
return self._swaptxcreate_ui_common(t, expect=':358e6/3/0')
|
||||
|
||||
def swaptxcreate5(self):
|
||||
t = self._swaptxcreate(
|
||||
|
|
@ -565,7 +565,7 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
add_opts = ['--trade-limit=3.6'])
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
return self._swaptxcreate_ui_common(t, expect=':36e7/1/0')
|
||||
return self._swaptxcreate_ui_common(t, expect=':36e7/3/0')
|
||||
|
||||
def swaptxcreate6(self):
|
||||
addr = make_burn_addr(self.protos[1], mmtype='bech32')
|
||||
|
|
@ -574,14 +574,14 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
add_opts = ['--trade-limit=2.7%'])
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
t.expect('to confirm: ', 'YES\n')
|
||||
return self._swaptxcreate_ui_common(t, expect=':3445e5/1/0')
|
||||
return self._swaptxcreate_ui_common(t, expect=':3445e5/3/0')
|
||||
|
||||
def swaptxcreate7(self):
|
||||
t = self._swaptxcreate(['BCH', '0.56789', 'LTC'])
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
t.expect('Enter a number> ', '1')
|
||||
t.expect('OK? (Y/n): ', 'y')
|
||||
return self._swaptxcreate_ui_common(t, expect=':0/1/0')
|
||||
return self._swaptxcreate_ui_common(t, expect=':0/3/0')
|
||||
|
||||
def swaptxcreate_bad1(self):
|
||||
t = self._swaptxcreate_bad(
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class unit_tests:
|
|||
assert p.asset == token or coin.upper()
|
||||
assert p.address == addr.views[addr.view_pref]
|
||||
assert p.trade_limit == limit_chk
|
||||
assert p.stream_interval == 1
|
||||
assert p.stream_interval == 3
|
||||
assert p.stream_quantity == 0 # auto
|
||||
|
||||
vmsg('\nTesting is_partial_memo():')
|
||||
|
|
@ -121,11 +121,11 @@ class unit_tests:
|
|||
ut.process_bad_data((
|
||||
('bad1', 'SwapMemoParseError', 'must contain', bad('x')),
|
||||
('bad2', 'SwapMemoParseError', 'must contain', bad('y:z:x')),
|
||||
('bad3', 'SwapMemoParseError', 'function abbrev', bad('z:l:foobar:0/1/0')),
|
||||
('bad4', 'SwapAssetError', 'unrecognized', bad('=:x:foobar:0/1/0')),
|
||||
('bad3', 'SwapMemoParseError', 'function abbrev', bad('z:l:foobar:0/3/0')),
|
||||
('bad4', 'SwapAssetError', 'unrecognized', bad('=:x:foobar:0/3/0')),
|
||||
('bad5', 'SwapMemoParseError', 'failed to parse', bad('=:l:foobar:n')),
|
||||
('bad6', 'SwapMemoParseError', 'invalid specifier', bad('=:l:foobar:x/1/0')),
|
||||
('bad7', 'SwapMemoParseError', 'extra', bad('=:l:foobar:0/1/0:x')),
|
||||
('bad6', 'SwapMemoParseError', 'invalid specifier', bad('=:l:foobar:x/3/0')),
|
||||
('bad7', 'SwapMemoParseError', 'extra', bad('=:l:foobar:0/3/0:x')),
|
||||
('bad10', 'AssertionError', 'recv', bad10),
|
||||
('bad11', 'SwapAssetError', 'unrecognized', bad11),
|
||||
('bad12', 'SwapAssetError', 'unsupported', bad12),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue