22 lines
446 B
Python
22 lines
446 B
Python
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()
|