Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def verify_and_get_quality(self) -> Optional[bytes32]:
v: Verifier = Verifier()
plot_seed: bytes32 = self.get_plot_seed()
quality_str = v.validate_proof(plot_seed, self.size, self.challenge_hash,
bytes(self.proof))
if not quality_str:
return None
return self.quality_str_to_quality(self.challenge_hash, quality_str)
async def request_header_hash(
self, request: farmer_protocol.RequestHeaderHash
) -> OutboundMessageGenerator:
"""
Creates a block body and header, with the proof of space, coinbase, and fee targets provided
by the farmer, and sends the hash of the header data back to the farmer.
"""
plot_seed: bytes32 = request.proof_of_space.get_plot_seed()
# Checks that the proof of space is valid
quality_string: bytes = Verifier().validate_proof(
plot_seed,
request.proof_of_space.size,
request.challenge_hash,
bytes(request.proof_of_space.proof),
)
assert quality_string
async with self.store.lock:
# Retrieves the correct head for the challenge
heads: List[HeaderBlock] = self.blockchain.get_current_tips()
target_head: Optional[HeaderBlock] = None
for head in heads:
assert head.challenge
if head.challenge.get_hash() == request.challenge_hash:
target_head = head
if target_head is None: