diff --git a/onionrblocks/__init__.py b/onionrblocks/__init__.py index 6b7d779..1134b3d 100644 --- a/onionrblocks/__init__.py +++ b/onionrblocks/__init__.py @@ -13,11 +13,11 @@ def _packer(block_data: bytes, **kasten_header) -> kasten.main.KastenPacked: return kasten.generator.pack.pack( block_data, kasten_header['type'], - kasten_header['encrypt_mode'], + kasten_header['encrypt mode'], __get_optional('signer', b''), __get_optional('signature', b''), __get_optional('metadata', {}), - int(time.time()//60 * 60) + int(time()//60 * 60) ) @@ -27,5 +27,6 @@ def _packer(block_data: bytes, **kasten_header) -> kasten.main.KastenPacked: def create_block_anonymous_vdf( rounds: int, block_data: Union[str, bytes], **block_header): # Block with anonymous VDF as proof - packed = _packer(block_data, block_header) - kasten.generator.KastenMimcGenerator.generate(packed, rounds) \ No newline at end of file + packed = _packer(block_data, **block_header) + return kasten.generator.KastenMimcGenerator.generate( + packed, rounds) diff --git a/tests/test.py b/tests/test.py deleted file mode 100644 index 0d6f79c..0000000 --- a/tests/test.py +++ /dev/null @@ -1,7 +0,0 @@ -import unittest -class TestBasic(unittest.TestCase): - - def test_basic(self): - self.assertTrue(True) - -unittest.main() \ No newline at end of file diff --git a/tests/test_vdf_block.py b/tests/test_vdf_block.py new file mode 100644 index 0000000..3bf7195 --- /dev/null +++ b/tests/test_vdf_block.py @@ -0,0 +1,18 @@ +import unittest +import binascii + +import kasten + +import onionrblocks + +class TestVDFBlock(unittest.TestCase): + + def test_basic(self): + rounds = 10**4 + k = onionrblocks.create_block_anonymous_vdf(rounds, b'test', **{'type': 'test', 'encrypt mode': 0}) + raw = k.data + id = binascii.hexlify(k.id) + kasten.generator.vdf_verify(raw, id, rounds) + + +unittest.main() \ No newline at end of file