diff --git a/bitcoin_client/.gitignore b/bitcoin_client/.gitignore index 0021b4fb3..108413e8c 100644 --- a/bitcoin_client/.gitignore +++ b/bitcoin_client/.gitignore @@ -1 +1,2 @@ -dist/** \ No newline at end of file +dist/** +**/.venv diff --git a/bitcoin_client/ledger_bitcoin/client_legacy.py b/bitcoin_client/ledger_bitcoin/client_legacy.py index f5d45f366..1f21a922a 100644 --- a/bitcoin_client/ledger_bitcoin/client_legacy.py +++ b/bitcoin_client/ledger_bitcoin/client_legacy.py @@ -281,7 +281,7 @@ def sign_psbt(self, psbt: Union[PSBT, bytes, str], wallet: WalletPolicy, wallet_ all_signature_attempts[i_num] = signature_attempts - result: List[Tuple(int, PartialSignature)] = [] + result: List[Tuple[int, PartialSignature]] = [] # Sign any segwit inputs if has_segwit: diff --git a/bitcoin_client/ledger_bitcoin/exception/device_exception.py b/bitcoin_client/ledger_bitcoin/exception/device_exception.py index 63c2333fd..7596420ad 100644 --- a/bitcoin_client/ledger_bitcoin/exception/device_exception.py +++ b/bitcoin_client/ledger_bitcoin/exception/device_exception.py @@ -6,8 +6,9 @@ class DeviceException(Exception): # pylint: disable=too-few-public-methods exc: Dict[int, Any] = { + 0x5515: SecurityStatusNotSatisfiedError, # returned by sdk in recent versions 0x6985: DenyError, - 0x6982: SecurityStatusNotSatisfiedError, + 0x6982: SecurityStatusNotSatisfiedError, # used in older app versions 0x6A80: IncorrectDataError, 0x6A82: NotSupportedError, 0x6A86: WrongP1P2Error, diff --git a/tests/test_status_word.py b/tests/test_status_word.py index 5af1b3908..22916b194 100644 --- a/tests/test_status_word.py +++ b/tests/test_status_word.py @@ -29,11 +29,12 @@ def test_status_word(sw_h_path): expected_status_words: List[Tuple[str, int]] = parse_sw(sw_h_path) status_words: Dict[int, Any] = DeviceException.exc - assert len(expected_status_words) == len(status_words), ( + assert len(expected_status_words) == len(set(status_words.values())), ( f"{expected_status_words} doesn't match {status_words}") # just keep status words expected_status_words = [sw for (identifier, sw) in expected_status_words] for sw in status_words.keys(): - assert sw in expected_status_words, f"{status_words[sw]}({hex(sw)}) not found in sw.h!" + if sw != 0x5515: # this is the only one that is defined in the SDK + assert sw in expected_status_words, f"{status_words[sw]}({hex(sw)}) not found in sw.h!"