onionrblocks/tests/test_vdf_block.py

24 lines
599 B
Python
Raw Normal View History

import unittest
import binascii
import kasten
import onionrblocks
class TestVDFBlock(unittest.TestCase):
2020-12-07 14:54:25 +00:00
def test_vdf_create(self):
rounds = 10**4
2020-12-07 01:58:09 +00:00
data = b'test data'
k = onionrblocks.create_block_anonymous_vdf(rounds, data, **{'type': 'test', 'encrypt mode': 0})
raw = k.raw_bytes
2020-12-07 14:54:25 +00:00
id = int.from_bytes(k.dec_checksum, byteorder="big")
2020-12-07 01:58:09 +00:00
#print(id, raw)
2020-12-07 14:54:25 +00:00
print(id, raw)
2020-12-07 01:58:09 +00:00
kasten.generator.KastenMimcGenerator.validate_id(id, raw, rounds)
2020-12-07 14:54:25 +00:00
self.assertEqual(len(raw), 22)
def test_vdf_auto_validate_loader
unittest.main()