mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-28 18:14:19 -05:00
<!-- Merging Requirements: - Please give your PR a title that is release-note friendly - In order to be merged, you must add the most appropriate category Label (Added, Changed, Fixed) to your PR --> <!-- Explain why this is an improvement (Does this add missing functionality, improve performance, or reduce complexity?) --> ### Purpose: This PR removes a dependency that is inappropriate and caused a dependency loop.
25 lines
966 B
Python
25 lines
966 B
Python
from __future__ import annotations
|
|
|
|
from chia_rs.sized_bytes import bytes32
|
|
from chia_rs.sized_ints import uint32, uint64
|
|
|
|
from chia.types.blockchain_format.coin import Coin
|
|
|
|
|
|
def pool_parent_id(block_height: uint32, genesis_challenge: bytes32) -> bytes32:
|
|
return bytes32(genesis_challenge[:16] + block_height.to_bytes(16, "big"))
|
|
|
|
|
|
def farmer_parent_id(block_height: uint32, genesis_challenge: bytes32) -> bytes32:
|
|
return bytes32(genesis_challenge[16:] + block_height.to_bytes(16, "big"))
|
|
|
|
|
|
def create_pool_coin(block_height: uint32, puzzle_hash: bytes32, reward: uint64, genesis_challenge: bytes32) -> Coin:
|
|
parent_id = pool_parent_id(block_height, genesis_challenge)
|
|
return Coin(parent_id, puzzle_hash, reward)
|
|
|
|
|
|
def create_farmer_coin(block_height: uint32, puzzle_hash: bytes32, reward: uint64, genesis_challenge: bytes32) -> Coin:
|
|
parent_id = farmer_parent_id(block_height, genesis_challenge)
|
|
return Coin(parent_id, puzzle_hash, reward)
|