Fix withdrawal error.

This commit is contained in:
tecnovert 2021-07-28 13:51:17 +02:00
parent 2be16465fb
commit 1b2ec61816
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 21 additions and 3 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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):

View file

@ -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)