Skip to content

Commit

Permalink
[REF] Fix unittests with legacy witness type
Browse files Browse the repository at this point in the history
  • Loading branch information
mccwdev committed Sep 22, 2023
1 parent 08ef79f commit 51253b8
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/test_wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ def test_wallet_multisig_2of2_with_single_key(self):
k2 = wl.new_key()
k3 = wl.new_key_change()
wl.utxos_update()
self.assertEqual(wl.public_master()[1].wif, keys[1].wif())
self.assertEqual(wl.public_master()[1].wif, keys[1].wif(multisig=True))
key_names = [k.name for k in wl.keys(is_active=False)]
self.assertListEqual(key_names, [k1.name, k2.name, k3.name])

Expand Down Expand Up @@ -1319,15 +1319,15 @@ def test_wallet_multisig_reopen_wallet(self):
def _open_all_wallets():
wl1 = wallet_create_or_open(
'multisigmulticur1_tst', sigs_required=2, network=network,
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='legacy',
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='segwit',
keys=[pk1, pk2.public_master(), pk3.public_master()])
wl2 = wallet_create_or_open(
'multisigmulticur2_tst', sigs_required=2, network=network,
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='legacy',
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='segwit',
keys=[pk1.public_master(), pk2, pk3.public_master()])
wl3 = wallet_create_or_open(
'multisigmulticur3_tst', sigs_required=2, network=network,
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='legacy',
db_uri=self.DATABASE_URI, sort_keys=False, witness_type='segwit',
keys=[pk1.public_master(), pk2.public_master(), pk3])
return wl1, wl2, wl3

Expand All @@ -1341,11 +1341,13 @@ def _open_all_wallets():
pk3 = HDKey.from_passphrase(phrase3, multisig=True, network=network)
wallets = _open_all_wallets()
for wlt in wallets:
self.assertEqual(wlt.get_key(cosigner_id=1).address, 'MQVt7KeRHGe35b9ziZo16T5y4fQPg6Up7q')
self.assertEqual(wlt.get_key(cosigner_id=1).address,
'ltc1qmw3e97pgrwypr0378wjje984guu0jy3ye4n523lcymk3rctuef6q7t3sek')
del wallets
wallets2 = _open_all_wallets()
for wlt in wallets2:
self.assertEqual(wlt.get_key(cosigner_id=1).address, 'MQVt7KeRHGe35b9ziZo16T5y4fQPg6Up7q')
self.assertEqual(wlt.get_key(cosigner_id=1).address,
'ltc1qmw3e97pgrwypr0378wjje984guu0jy3ye4n523lcymk3rctuef6q7t3sek')

def test_wallet_multisig_network_mixups(self):
self.db_remove()
Expand Down Expand Up @@ -1937,10 +1939,10 @@ def test_wallet_transaction_sign_with_hex(self):
self.assertTrue(wt.verified)

def test_wallet_transaction_sign_with_wif(self):
wif = ('BC17qWy2RMw8AmwsqwTXpokwXXwhaWmUpqtAc5iGGzrFXs13PkKERJUyobB9YUbzT8hJ8EiCtcqdEpeRy7wyvE1esehD'
'8bVpgzzdEw9ndQbjyF5w')
wif2 = ('BC17qWy2RMw8AmwsqwTjmX2SwwSHBNA2c6KyGHs5Kghg3q6dPa4ajP1jwFBPCkoSeXWsPAiVD2iAcroVc6cJQmHrYatviN'
'Ck5jDM83DkbPGFxbCK')
wif = ('BC19UtECk2r9PVQYhZuLSVjB6M7QPkAQSJN59RJKZQuuuPxaxNBEwmnfpWYvrQTrJZCANKoXBm7HKY78dVHjTkqoqA67aUf'
'NSLZjuwNGDBMQD7uM')
wif2 = ('BC19UtECk2r9PVQYhYJrXwB3We4E9Xc6uJngAEoqBrntN1gpGZwAWKRdcupdf2iKFLfY3pYRxHAi99EZ7dyYcKLZ2a7999'
'Lu2NRSZzToFXib5kcE')
w = wallet_create_or_open('test_wallet_transaction_sign_with_wif',
keys=[wif, HDKey(wif2).public_master_multisig(witness_type='segwit')],
witness_type='segwit', network='bitcoinlib_test',
Expand Down

0 comments on commit 51253b8

Please sign in to comment.