ot_ltc_mainnet.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
  5. """
  6. test.objtest_py_d.ot_ltc_mainnet: LTC mainnet test vectors for MMGen data objects
  7. """
  8. from decimal import Decimal
  9. from mmgen.amt import LTCAmt
  10. from mmgen.addr import CoinAddr
  11. from mmgen.key import WifKey,PrivKey
  12. from mmgen.protocol import init_proto
  13. from .ot_common import r16,r32
  14. from ..include.common import cfg
  15. proto = init_proto( cfg, 'ltc', need_amt=True )
  16. tests = {
  17. 'LTCAmt': {
  18. 'bad': ('-3.2','0.123456789',123,'123L','88000000',80999999.12345678),
  19. 'good': (('80999999.12345678',Decimal('80999999.12345678')),)
  20. },
  21. 'CoinAddr': {
  22. 'bad': (
  23. {'addr':1, 'proto':proto},
  24. {'addr':'x', 'proto':proto},
  25. {'addr':'я', 'proto':proto},
  26. ),
  27. 'good': (
  28. {'addr':'LXYx4j8PDGE8GEwDFnEQhcLyHFGsRxSJwt', 'proto':proto},
  29. {'addr':'MEnuCzUGHaQx9fK5WYvLwR1NK4SAo8HmSr', 'proto':proto},
  30. ),
  31. },
  32. 'WifKey': {
  33. 'bad': (
  34. {'proto':proto, 'wif':1},
  35. {'proto':proto, 'wif':[]},
  36. {'proto':proto, 'wif':'\0'},
  37. {'proto':proto, 'wif':'\1'},
  38. {'proto':proto, 'wif':'я'},
  39. {'proto':proto, 'wif':'g'},
  40. {'proto':proto, 'wif':'gg'},
  41. {'proto':proto, 'wif':'FF'},
  42. {'proto':proto, 'wif':'f00'},
  43. {'proto':proto, 'wif':r16.hex()},
  44. {'proto':proto, 'wif':'2MspvWFjBbkv2wzQGqhxJUYPCk3Y2jMaxLN'},
  45. ),
  46. 'good': (
  47. {'proto':proto, 'wif':'6udBAGS6B9RfGyvEQDkVDsWy3Kqv9eTULqtEfVkJtTJyHdLvojw', 'ret_idx':1},
  48. {'proto':proto, 'wif':'T7kCSp5E71jzV2zEJW4q5qU1SMB5CSz8D9VByxMBkamv1uM3Jjca', 'ret_idx':1},
  49. )
  50. },
  51. 'PrivKey': {
  52. 'bad': (
  53. {'proto':proto, 'wif':1},
  54. {'proto':proto, 'wif':'1'},
  55. {'proto':proto, 'wif':'cMsqcmDYZP1LdKgqRh9L4ZRU9br28yvdmTPwW2YQwVSN9aQiMAoR'},
  56. {'proto':proto, 's':r32,'wif':'6ufJhtQQiRYA3w2QvDuXNXuLgPFp15i3HR1Wp8An2mx1JnhhJAh'},
  57. {'proto':proto, 'pubkey_type':'std'},
  58. {'proto':proto, 's':r32},
  59. {'proto':proto, 's':r32,'compressed':'yes'},
  60. {'proto':proto, 's':r32,'compressed':'yes','pubkey_type':'std'},
  61. {'proto':proto, 's':r32,'compressed':True,'pubkey_type':'nonstd'},
  62. {'proto':proto, 's':r32+b'x','compressed':True,'pubkey_type':'std'}
  63. ),
  64. 'good': (
  65. {'proto':proto, 'wif':'6ufJhtQQiRYA3w2QvDuXNXuLgPFp15i3HR1Wp8An2mx1JnhhJAh',
  66. 'ret':bytes.fromhex('470a974ffca9fca1299b706b09142077bea3acbab6d6480b87dbba79d5fd279b')},
  67. {'proto':proto, 'wif':'T41Fm7J3mtZLKYPMCLVSFARz4QF8nvSDhLAfW97Ds56Zm9hRJgn8',
  68. 'ret':bytes.fromhex('1c6feab55a4c3b4ad1823d4ecacd1565c64228c01828cf44fb4db1e2d82c3d56')},
  69. {'proto':proto, 's':r32,'compressed':False,'pubkey_type':'std','ret':r32},
  70. {'proto':proto, 's':r32,'compressed':True,'pubkey_type':'std','ret':r32}
  71. )
  72. },
  73. }