mirror of
https://github.com/basicswap/basicswap.git
synced 2024-11-17 00:07:56 +00:00
tests: Add use_segwit to required settings.
This commit is contained in:
parent
d6f6a73324
commit
843379325f
2 changed files with 17 additions and 8 deletions
|
@ -493,7 +493,6 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||
if swap_client.debug is True:
|
||||
swap_client.log.error(traceback.format_exc())
|
||||
|
||||
|
||||
swap_client.updateWalletsInfo()
|
||||
wallets = swap_client.getCachedWalletsInfo({'coin_id': coin_id})
|
||||
for k in wallets.keys():
|
||||
|
@ -569,7 +568,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||
|
||||
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:
|
||||
utxo_groups += kv[0] + ' ' + ci.format_amount(kv[1]) + '\n'
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ from basicswap.util import (
|
|||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
REQUIRED_SETTINGS = {'blocks_confirmed': 1, 'conf_target': 1, 'use_segwit': True}
|
||||
|
||||
def test_serialise_num(self):
|
||||
def test_case(v, nb=None):
|
||||
b = SerialiseNum(v)
|
||||
|
@ -54,7 +56,9 @@ class Test(unittest.TestCase):
|
|||
test_case(4194642)
|
||||
|
||||
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')
|
||||
|
||||
time_val = 48 * 60 * 60
|
||||
|
@ -160,7 +164,8 @@ class Test(unittest.TestCase):
|
|||
assert(pubkey == pubkey_test)
|
||||
|
||||
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')
|
||||
vk_sign = i2b(ci.getNewSecretKey())
|
||||
vk_encrypt = i2b(ci.getNewSecretKey())
|
||||
|
@ -182,7 +187,8 @@ class Test(unittest.TestCase):
|
|||
assert(vk_encrypt == recovered_key)
|
||||
|
||||
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')
|
||||
|
||||
vk = i2b(ci.getNewSecretKey())
|
||||
|
@ -196,7 +202,8 @@ class Test(unittest.TestCase):
|
|||
ci.verifySig(pk, message_hash, sig)
|
||||
|
||||
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')
|
||||
|
||||
vk = i2b(ci.getNewSecretKey())
|
||||
|
@ -206,14 +213,17 @@ class Test(unittest.TestCase):
|
|||
ci.verifyCompact(pk, 'test signing message', sig)
|
||||
|
||||
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')
|
||||
pk = h2b('02c26a344e7d21bcc6f291532679559f2fd234c881271ff98714855edc753763a6')
|
||||
addr = ci.pubkey_to_address(pk)
|
||||
assert(addr == 'mj6SdSxmWRmdDqR5R3FfZmRiLmQfQAsLE8')
|
||||
|
||||
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')
|
||||
|
||||
key = i2b(ci.getNewSecretKey())
|
||||
|
|
Loading…
Reference in a new issue