ot_ltc_testnet.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
  5. """
  6. test.objtest_d.ot_ltc_testnet: LTC testnet test vectors for MMGen data objects
  7. """
  8. from mmgen.addr import CoinAddr
  9. from mmgen.key import WifKey, PrivKey
  10. from mmgen.protocol import init_proto
  11. from .ot_common import r16, r32
  12. from ..include.common import cfg
  13. proto = init_proto(cfg, 'ltc', network='testnet', need_amt=True)
  14. tests = {
  15. 'CoinAddr': {
  16. 'bad': (
  17. {'addr': 1, 'proto': proto},
  18. {'addr': 'x', 'proto': proto},
  19. {'addr': 'я', 'proto': proto},
  20. ),
  21. 'good': (
  22. {'addr': 'n2D3joAy3yE5fqxUeCp38X6uPUcVn7EFw9', 'proto': proto},
  23. {'addr': 'QN59YbnHsPQcbKWSq9PmTpjrhBnHGQqRmf', 'proto': proto},
  24. ),
  25. },
  26. 'WifKey': {
  27. 'bad': (
  28. {'proto': proto, 'wif': 1},
  29. {'proto': proto, 'wif': []},
  30. {'proto': proto, 'wif': '\0'},
  31. {'proto': proto, 'wif': '\1'},
  32. {'proto': proto, 'wif': 'я'},
  33. {'proto': proto, 'wif': 'g'},
  34. {'proto': proto, 'wif': 'gg'},
  35. {'proto': proto, 'wif': 'FF'},
  36. {'proto': proto, 'wif': 'f00'},
  37. {'proto': proto, 'wif': r16.hex()},
  38. {'proto': proto, 'wif': '2MspvWFjBbkv2wzQGqhxJUYPCk3Y2jMaxLN'},
  39. ),
  40. 'good': (
  41. {'proto': proto, 'wif': '936Fd4qs3Zy2ZiYHH7vZ3UpT23KtCAiGiG2xBTkjHo7jE9aWA2f', 'ret_idx': 1},
  42. {'proto': proto, 'wif': 'cQY3EumdaSNuttvDSUuPdiMYLyw8aVmYfFqxo9kdPuWbJBN4Ny66', 'ret_idx': 1},
  43. )
  44. },
  45. 'PrivKey': {
  46. 'bad': (
  47. {'proto': proto, 'wif': 1},
  48. {'proto': proto, 'wif': '1'},
  49. {'proto': proto, 'wif': '5KXEpVzjWreTcQoG5hX357s1969MUKNLuSfcszF6yu84kpsNZKb'},
  50. {'proto': proto, 's': r32, 'wif': '5KXEpVzjWreTcQoG5hX357s1969MUKNLuSfcszF6yu84kpsNZKb'},
  51. {'proto': proto, 'pubkey_type': 'std'},
  52. {'proto': proto, 's': r32},
  53. {'proto': proto, 's': r32, 'compressed': 'yes'},
  54. {'proto': proto, 's': r32, 'compressed': 'yes', 'pubkey_type': 'std'},
  55. {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'nonstd'},
  56. {'proto': proto, 's': r32+b'x', 'compressed': True, 'pubkey_type': 'std'}
  57. ),
  58. 'good': (
  59. {'proto': proto, 'wif': '92iqzh6NqiKawyB1ronw66YtEHrU4rxRJ5T4aHniZqvuSVZS21f',
  60. 'ret': bytes.fromhex('95b2aa7912550eacdd3844dcc14bee08ce7bc2434ad4858beb136021e945afeb')},
  61. {'proto': proto, 'wif': 'cSaJAXBAm9ooHpVJgoxqjDG3AcareFy29Cz8mhnNTRijjv2HLgta',
  62. 'ret': bytes.fromhex('94fa8b90c11fea8fb907c9376b919534b0a75b9a9621edf71a78753544b4101c')},
  63. {'proto': proto, 's': r32, 'compressed': False, 'pubkey_type': 'std', 'ret': r32},
  64. {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32}
  65. )
  66. },
  67. }