2024-11-15 12:55:14 +00:00
|
|
|
# flake8: noqa: F403,F405
|
2024-01-26 11:16:55 +00:00
|
|
|
from common import * # isort:skip
|
2018-08-30 11:45:09 +00:00
|
|
|
|
2019-08-26 16:47:49 +00:00
|
|
|
if not utils.BITCOIN_ONLY:
|
2020-09-23 10:31:07 +00:00
|
|
|
from apps.ripple.helpers import address_from_public_key
|
2018-08-30 11:45:09 +00:00
|
|
|
|
2019-08-26 16:47:49 +00:00
|
|
|
|
|
|
|
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
2018-08-30 11:45:09 +00:00
|
|
|
class TestRippleAddress(unittest.TestCase):
|
|
|
|
def test_pubkey_to_address(self):
|
2023-06-28 10:46:29 +00:00
|
|
|
addr = address_from_public_key(
|
|
|
|
unhexlify(
|
|
|
|
"ed9434799226374926eda3b54b1b461b4abf7237962eae18528fea67595397fa32"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.assertEqual(addr, "rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhmN")
|
|
|
|
|
|
|
|
addr = address_from_public_key(
|
|
|
|
unhexlify(
|
|
|
|
"03e2b079e9b09ae8916da8f5ee40cbda9578dbe7c820553fe4d5f872eec7b1fdd4"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.assertEqual(addr, "rhq549rEtUrJowuxQC2WsHNGLjAjBQdAe8")
|
|
|
|
|
|
|
|
addr = address_from_public_key(
|
|
|
|
unhexlify(
|
|
|
|
"0282ee731039929e97db6aec242002e9aa62cd62b989136df231f4bb9b8b7c7eb2"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.assertEqual(addr, "rKzE5DTyF9G6z7k7j27T2xEas2eMo85kmw")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2018-08-30 11:45:09 +00:00
|
|
|
unittest.main()
|