tests: Add use_segwit to required settings.
This commit is contained in:
parent
d6f6a73324
commit
843379325f
@ -493,7 +493,6 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||||||
if swap_client.debug is True:
|
if swap_client.debug is True:
|
||||||
swap_client.log.error(traceback.format_exc())
|
swap_client.log.error(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
swap_client.updateWalletsInfo()
|
swap_client.updateWalletsInfo()
|
||||||
wallets = swap_client.getCachedWalletsInfo({'coin_id': coin_id})
|
wallets = swap_client.getCachedWalletsInfo({'coin_id': coin_id})
|
||||||
for k in wallets.keys():
|
for k in wallets.keys():
|
||||||
@ -569,7 +568,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
unspent_by_addr = swap_client.getUnspentsByAddr(k)
|
unspent_by_addr = swap_client.getUnspentsByAddr(k)
|
||||||
|
|
||||||
sorted_unspent_by_addr = sorted(unspent_by_addr.items(), key=lambda x:x[1], reverse=True)
|
sorted_unspent_by_addr = sorted(unspent_by_addr.items(), key=lambda x: x[1], reverse=True)
|
||||||
for kv in sorted_unspent_by_addr:
|
for kv in sorted_unspent_by_addr:
|
||||||
utxo_groups += kv[0] + ' ' + ci.format_amount(kv[1]) + '\n'
|
utxo_groups += kv[0] + ' ' + ci.format_amount(kv[1]) + '\n'
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ from basicswap.util import (
|
|||||||
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
REQUIRED_SETTINGS = {'blocks_confirmed': 1, 'conf_target': 1, 'use_segwit': True}
|
||||||
|
|
||||||
def test_serialise_num(self):
|
def test_serialise_num(self):
|
||||||
def test_case(v, nb=None):
|
def test_case(v, nb=None):
|
||||||
b = SerialiseNum(v)
|
b = SerialiseNum(v)
|
||||||
@ -54,7 +56,9 @@ class Test(unittest.TestCase):
|
|||||||
test_case(4194642)
|
test_case(4194642)
|
||||||
|
|
||||||
def test_sequence(self):
|
def test_sequence(self):
|
||||||
coin_settings = {'rpcport': 0, 'rpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'rpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
|
|
||||||
ci = BTCInterface(coin_settings, 'regtest')
|
ci = BTCInterface(coin_settings, 'regtest')
|
||||||
|
|
||||||
time_val = 48 * 60 * 60
|
time_val = 48 * 60 * 60
|
||||||
@ -160,7 +164,8 @@ class Test(unittest.TestCase):
|
|||||||
assert(pubkey == pubkey_test)
|
assert(pubkey == pubkey_test)
|
||||||
|
|
||||||
def test_ecdsa_otves(self):
|
def test_ecdsa_otves(self):
|
||||||
coin_settings = {'rpcport': 0, 'rpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'rpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
ci = BTCInterface(coin_settings, 'regtest')
|
ci = BTCInterface(coin_settings, 'regtest')
|
||||||
vk_sign = i2b(ci.getNewSecretKey())
|
vk_sign = i2b(ci.getNewSecretKey())
|
||||||
vk_encrypt = i2b(ci.getNewSecretKey())
|
vk_encrypt = i2b(ci.getNewSecretKey())
|
||||||
@ -182,7 +187,8 @@ class Test(unittest.TestCase):
|
|||||||
assert(vk_encrypt == recovered_key)
|
assert(vk_encrypt == recovered_key)
|
||||||
|
|
||||||
def test_sign(self):
|
def test_sign(self):
|
||||||
coin_settings = {'rpcport': 0, 'rpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'rpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
ci = BTCInterface(coin_settings, 'regtest')
|
ci = BTCInterface(coin_settings, 'regtest')
|
||||||
|
|
||||||
vk = i2b(ci.getNewSecretKey())
|
vk = i2b(ci.getNewSecretKey())
|
||||||
@ -196,7 +202,8 @@ class Test(unittest.TestCase):
|
|||||||
ci.verifySig(pk, message_hash, sig)
|
ci.verifySig(pk, message_hash, sig)
|
||||||
|
|
||||||
def test_sign_compact(self):
|
def test_sign_compact(self):
|
||||||
coin_settings = {'rpcport': 0, 'rpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'rpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
ci = BTCInterface(coin_settings, 'regtest')
|
ci = BTCInterface(coin_settings, 'regtest')
|
||||||
|
|
||||||
vk = i2b(ci.getNewSecretKey())
|
vk = i2b(ci.getNewSecretKey())
|
||||||
@ -206,14 +213,17 @@ class Test(unittest.TestCase):
|
|||||||
ci.verifyCompact(pk, 'test signing message', sig)
|
ci.verifyCompact(pk, 'test signing message', sig)
|
||||||
|
|
||||||
def test_pubkey_to_address(self):
|
def test_pubkey_to_address(self):
|
||||||
coin_settings = {'rpcport': 0, 'rpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'rpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
ci = BTCInterface(coin_settings, 'regtest')
|
ci = BTCInterface(coin_settings, 'regtest')
|
||||||
pk = h2b('02c26a344e7d21bcc6f291532679559f2fd234c881271ff98714855edc753763a6')
|
pk = h2b('02c26a344e7d21bcc6f291532679559f2fd234c881271ff98714855edc753763a6')
|
||||||
addr = ci.pubkey_to_address(pk)
|
addr = ci.pubkey_to_address(pk)
|
||||||
assert(addr == 'mj6SdSxmWRmdDqR5R3FfZmRiLmQfQAsLE8')
|
assert(addr == 'mj6SdSxmWRmdDqR5R3FfZmRiLmQfQAsLE8')
|
||||||
|
|
||||||
def test_dleag(self):
|
def test_dleag(self):
|
||||||
coin_settings = {'rpcport': 0, 'walletrpcport': 0, 'walletrpcauth': 'none', 'blocks_confirmed': 1, 'conf_target': 1}
|
coin_settings = {'rpcport': 0, 'walletrpcport': 0, 'walletrpcauth': 'none'}
|
||||||
|
coin_settings.update(self.REQUIRED_SETTINGS)
|
||||||
|
|
||||||
ci = XMRInterface(coin_settings, 'regtest')
|
ci = XMRInterface(coin_settings, 'regtest')
|
||||||
|
|
||||||
key = i2b(ci.getNewSecretKey())
|
key = i2b(ci.getNewSecretKey())
|
||||||
|
Loading…
Reference in New Issue
Block a user