diff --git a/basicswap/db.py b/basicswap/db.py index f0723b5..f0320f3 100644 --- a/basicswap/db.py +++ b/basicswap/db.py @@ -12,7 +12,7 @@ from enum import IntEnum, auto from sqlalchemy.ext.declarative import declarative_base -CURRENT_DB_VERSION = 8 +CURRENT_DB_VERSION = 9 Base = declarative_base() diff --git a/basicswap/http_server.py b/basicswap/http_server.py index 5078ef7..beb4d60 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -265,7 +265,8 @@ class HttpHandler(BaseHTTPRequestHandler): messages.append('Error: Missing type') if len(messages) == 0: - ticker = swap_client.getTicker(c) + ci = swap_client.ci(c) + ticker = ci.ticker() if c == Coins.PART: try: txid = swap_client.withdrawParticl(type_from, type_to, value, address, subfee) diff --git a/tests/basicswap/test_run.py b/tests/basicswap/test_run.py index d2042ae..bea3ccc 100644 --- a/tests/basicswap/test_run.py +++ b/tests/basicswap/test_run.py @@ -58,6 +58,7 @@ from tests.basicswap.common import ( wait_for_bid, wait_for_bid_tx_state, wait_for_in_progress, + post_json_req, TEST_HTTP_HOST, TEST_HTTP_PORT, BASE_PORT, @@ -647,6 +648,22 @@ class Test(unittest.TestCase): assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0) ''' + def test_12_withdrawal(self): + logging.info('---------- Test LTC withdrawals') + + ltc_addr = ltcRpc('getnewaddress "Withdrawal test" legacy') + logging.info('ltc_addr {}'.format(ltc_addr)) + wallets0 = json.loads(urlopen('http://127.0.0.1:{}/json/wallets'.format(TEST_HTTP_PORT + 0)).read()) + assert(float(wallets0['3']['balance']) > 100) + + post_json = { + 'value': 100, + 'address': ltc_addr, + 'subfee': False, + } + json_rv = json.loads(post_json_req('http://127.0.0.1:{}/json/wallets/ltc/withdraw'.format(TEST_HTTP_PORT + 0), post_json)) + assert(len(json_rv['txid']) == 64) + def pass_99_delay(self): logging.info('Delay') for i in range(60 * 10): diff --git a/tests/basicswap/test_xmr.py b/tests/basicswap/test_xmr.py index 3c9606c..919cb8c 100644 --- a/tests/basicswap/test_xmr.py +++ b/tests/basicswap/test_xmr.py @@ -641,7 +641,7 @@ class Test(unittest.TestCase): wait_for_no_offer(test_delay_event, swap_clients[1], offer_id) def test_08_withdraw(self): - logging.info('---------- Test xmr withdrawals') + logging.info('---------- Test XMR withdrawals') swap_clients = self.swap_clients js_0 = json.loads(urlopen('http://127.0.0.1:1800/json/wallets').read()) print('js_0 debug', js_0)