added partial test for vdf block create
This commit is contained in:
parent
1e554cad93
commit
c10a75e558
@ -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)
|
||||
packed = _packer(block_data, **block_header)
|
||||
return kasten.generator.KastenMimcGenerator.generate(
|
||||
packed, rounds)
|
||||
|
@ -1,7 +0,0 @@
|
||||
import unittest
|
||||
class TestBasic(unittest.TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
unittest.main()
|
18
tests/test_vdf_block.py
Normal file
18
tests/test_vdf_block.py
Normal file
@ -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()
|
Loading…
Reference in New Issue
Block a user