Skip to content

Commit

Permalink
Fix python legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Sep 25, 2023
1 parent d91efee commit 966473c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions bitcoin_client/ledger_bitcoin/client_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def __init__(self, comm_client: TransportClient, chain: Chain = Chain.MAIN, debu

self.app = btchip(DongleAdaptor(comm_client))

if self.app.getAppName() not in ["Qtum", "Qtum Legacy", "Qtum Test", "Qtum Test Legacy", "app"]:
raise ValueError("Ledger is not in either the Qtum or Qtum Testnet app")
if self.app.getAppName() not in ["Bitcoin", "Bitcoin Legacy", "Bitcoin Test", "Bitcoin Test Legacy", "app"]:
raise ValueError("Ledger is not in either the Bitcoin or Bitcoin Testnet app")

def get_extended_pubkey(self, path: str, display: bool = False) -> str:
# mostly taken from HWI
Expand Down
6 changes: 3 additions & 3 deletions bitcoin_client/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# path with tests
conftest_folder_path: Path = Path(__file__).parent

os.environ['SPECULOS_APPNAME'] = 'Qtum Test:1.6.5'
os.environ["BITCOIN_APP_BINARY"] = str(conftest_folder_path.joinpath("app-binaries/qtum-testnet-1.6.5.elf"))
os.environ["BITCOIN_APP_LIB_BINARY"] = str(conftest_folder_path.joinpath('app-binaries/qtum-1.6.5.elf'))
os.environ['SPECULOS_APPNAME'] = 'Bitcoin Test:1.6.5'
os.environ["BITCOIN_APP_BINARY"] = str(conftest_folder_path.joinpath("app-binaries/bitcoin-testnet-1.6.5.elf"))
os.environ["BITCOIN_APP_LIB_BINARY"] = str(conftest_folder_path.joinpath('app-binaries/bitcoin-1.6.5.elf'))
18 changes: 9 additions & 9 deletions bitcoin_client/tests/test_get_wallet_address_legacyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ def test_get_wallet_address_singlesig_legacy(client: Client):
name="",
descriptor_template="pkh(@0/**)",
keys_info=[
f"[350a4bc9/44'/1'/0']tpubDCwYjpDhUdPGP5rS3wgNg13mTrrjBuG8V9VpWbyptX6TRPbNoZVXsoVUSkCjmQ8jJycjuDKBb9eataSymXakTTaGifxR6kmVsfFehH1ZgJT",
f"[f5acc2fd/44'/1'/0']tpubDCwYjpDhUdPGP5rS3wgNg13mTrrjBuG8V9VpWbyptX6TRPbNoZVXsoVUSkCjmQ8jJycjuDKBb9eataSymXakTTaGifxR6kmVsfFehH1ZgJT",
],
)
assert client.get_wallet_address(wallet, None, 0, 0, False) == "qc8MCVJwQZTNdM2JhXhBs41fxZzZ8HN9cR"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "qbHdLA6nhsuNTvPoWZZm5RHSfXcLerpHLd"
assert client.get_wallet_address(wallet, None, 0, 0, False) == "mz5vLWdM1wHVGSmXUkhKVvZbJ2g4epMXSm"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "myFCUBRCKFjV7292HnZtiHqMzzHrApobpT"


def test_get_wallet_address_singlesig_wit(client: Client):
Expand All @@ -20,11 +20,11 @@ def test_get_wallet_address_singlesig_wit(client: Client):
name="",
descriptor_template="wpkh(@0/**)",
keys_info=[
f"[350a4bc9/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P",
f"[f5acc2fd/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P",
],
)
assert client.get_wallet_address(wallet, None, 0, 0, False) == "tq1qzdr7s2sr0dwmkwx033r4nujzk86u0cy6dcmgce"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "tq1qlrvzyx8jcjfj2xuy69du9trtxnsvjupefaqtd2"
assert client.get_wallet_address(wallet, None, 0, 0, False) == "tb1qzdr7s2sr0dwmkwx033r4nujzk86u0cy6fmzfjk"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "tb1qlrvzyx8jcjfj2xuy69du9trtxnsvjuped7e289"


def test_get_wallet_address_singlesig_sh_wit(client: Client):
Expand All @@ -33,8 +33,8 @@ def test_get_wallet_address_singlesig_sh_wit(client: Client):
name="",
descriptor_template="sh(wpkh(@0/**))",
keys_info=[
f"[350a4bc9/49'/1'/0']tpubDC871vGLAiKPcwAw22EjhKVLk5L98UGXBEcGR8gpcigLQVDDfgcYW24QBEyTHTSFEjgJgbaHU8CdRi9vmG4cPm1kPLmZhJEP17FMBdNheh3",
f"[f5acc2fd/49'/1'/0']tpubDC871vGLAiKPcwAw22EjhKVLk5L98UGXBEcGR8gpcigLQVDDfgcYW24QBEyTHTSFEjgJgbaHU8CdRi9vmG4cPm1kPLmZhJEP17FMBdNheh3",
],
)
assert client.get_wallet_address(wallet, None, 0, 0, False) == "mNDsvaF9HHvEFaH6FmLRR3kAJoPBD3XfdW"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "mZXUNuos7tQiTr6JVTHcqbFfrSTf8zGzxx"
assert client.get_wallet_address(wallet, None, 0, 0, False) == "2MyHkbusvLomaarGYMqyq7q9pSBYJRwWcsw"
assert client.get_wallet_address(wallet, None, 1, 15, False) == "2NAbM4FSeBQG4o85kbXw2YNfKypcnEZS9MR"
8 changes: 4 additions & 4 deletions bitcoin_client/tests/test_sign_psbt_legacyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_sign_psbt_singlesig_pkh_1to1(client: Client):
"",
"pkh(@0/**)",
[
"[350a4bc9/44'/1'/0']tpubDCwYjpDhUdPGP5rS3wgNg13mTrrjBuG8V9VpWbyptX6TRPbNoZVXsoVUSkCjmQ8jJycjuDKBb9eataSymXakTTaGifxR6kmVsfFehH1ZgJT"
"[f5acc2fd/44'/1'/0']tpubDCwYjpDhUdPGP5rS3wgNg13mTrrjBuG8V9VpWbyptX6TRPbNoZVXsoVUSkCjmQ8jJycjuDKBb9eataSymXakTTaGifxR6kmVsfFehH1ZgJT"
],
)

Expand Down Expand Up @@ -61,7 +61,7 @@ def test_sign_psbt_singlesig_sh_wpkh_1to2(client: Client):
"",
"sh(wpkh(@0/**))",
[
"[350a4bc9/49'/1'/0']tpubDC871vGLAiKPcwAw22EjhKVLk5L98UGXBEcGR8gpcigLQVDDfgcYW24QBEyTHTSFEjgJgbaHU8CdRi9vmG4cPm1kPLmZhJEP17FMBdNheh3"
"[f5acc2fd/49'/1'/0']tpubDC871vGLAiKPcwAw22EjhKVLk5L98UGXBEcGR8gpcigLQVDDfgcYW24QBEyTHTSFEjgJgbaHU8CdRi9vmG4cPm1kPLmZhJEP17FMBdNheh3"
],
)

Expand Down Expand Up @@ -94,7 +94,7 @@ def test_sign_psbt_singlesig_wpkh_1to2(client: Client):
"",
"wpkh(@0/**)",
[
"[350a4bc9/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P"
"[f5acc2fd/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P"
],
)

Expand Down Expand Up @@ -126,7 +126,7 @@ def test_sign_psbt_singlesig_wpkh_2to2(client: Client):
"",
"wpkh(@0/**)",
[
"[350a4bc9/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P"
"[f5acc2fd/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P"
],
)

Expand Down

0 comments on commit 966473c

Please sign in to comment.