2021-02-05 16:46:02 +00:00
|
|
|
# This file is part of the Trezor project.
|
|
|
|
#
|
2021-11-26 14:50:43 +00:00
|
|
|
# Copyright (C) 2012-2022 SatoshiLabs and contributors
|
2021-02-05 16:46:02 +00:00
|
|
|
#
|
|
|
|
# This library is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the License along with this library.
|
|
|
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
|
|
|
2023-10-18 14:15:59 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-02-05 16:46:02 +00:00
|
|
|
from trezorlib import tools
|
|
|
|
|
2023-10-18 14:15:59 +00:00
|
|
|
VECTORS = ( # descriptor, checksum
|
|
|
|
(
|
|
|
|
"pkh([5c9e228d/44h/0h/0h]xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy/0/*)",
|
|
|
|
"lnrxp640",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"pkh([5c9e228d/44h/0h/0h]xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy/1/*)",
|
|
|
|
"w8x8u09h",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"sh(wpkh([5c9e228d/49h/0h/0h]xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx/0/*))",
|
|
|
|
"kx6mu23v",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"sh(wpkh([5c9e228d/49h/0h/0h]xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx/1/*))",
|
|
|
|
"r85dy4yn",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"wpkh([5c9e228d/84h/0h/0h]xpub6DDUPHpUo4pcy43iJeZjbSVWGav1SMMmuWdMHiGtkK8rhKmfbomtkwW6GKs1GGAKehT6QRocrmda3WWxXawpjmwaUHfFRXuKrXSapdckEYF/0/*)",
|
|
|
|
"vyj8qz0q",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"wpkh([5c9e228d/84h/0h/0h]xpub6DDUPHpUo4pcy43iJeZjbSVWGav1SMMmuWdMHiGtkK8rhKmfbomtkwW6GKs1GGAKehT6QRocrmda3WWxXawpjmwaUHfFRXuKrXSapdckEYF/1/*)",
|
|
|
|
"ashxahlc",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
2021-02-05 16:46:02 +00:00
|
|
|
|
2023-10-18 14:15:59 +00:00
|
|
|
@pytest.mark.parametrize("descriptor, checksum", VECTORS)
|
|
|
|
def test_descriptor_checksum(descriptor, checksum):
|
|
|
|
assert tools.descriptor_checksum(descriptor) == checksum
|