aucoin/tests/helpers.py

22 lines
446 B
Python
Raw Normal View History

2018-07-15 23:30:55 +02:00
from threading import RLock
from cryptography.hazmat.primitives.asymmetric import ec
from aucoin import dsa
from aucoin.block import Block
def mine(block: Block, private_key: ec.EllipticCurvePrivateKey):
while True:
block.signature = dsa.sign(private_key, block.truncated_header)
if block.hash <= block.target:
break
return block
class Core(object):
def __init__(self):
self.lock = RLock()