mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-29 18:14:26 -05:00
* no need to check announcements in python, it's all done in rust * remove python condition parsing, use rust unconditionally * no need to assert_my_amount, it's done in rust * assert my puzzlehash is done in rust, no need to check it in python * parent id is checked in rust, no need to do it in python * my coin ID is checked in rust, no need to do it in python * reorder condition checks to have to ones we won't see at the end * no need for the RUST_CONDITION_CHECKER constant anymore * update pool tests to use get_name_puzzle_condition
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from typing import List, Tuple
|
|
|
|
from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions
|
|
from chia.types.blockchain_format.coin import Coin
|
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
from chia.types.full_block import FullBlock
|
|
from chia.types.generator_types import BlockGenerator
|
|
from chia.util.generator_tools import additions_for_npc
|
|
|
|
|
|
def run_and_get_removals_and_additions(
|
|
block: FullBlock, max_cost: int, cost_per_byte: int, safe_mode=False
|
|
) -> Tuple[List[bytes32], List[Coin]]:
|
|
removals: List[bytes32] = []
|
|
additions: List[Coin] = []
|
|
|
|
assert len(block.transactions_generator_ref_list) == 0
|
|
if not block.is_transaction_block():
|
|
return [], []
|
|
|
|
if block.transactions_generator is not None:
|
|
npc_result = get_name_puzzle_conditions(
|
|
BlockGenerator(block.transactions_generator, []),
|
|
max_cost,
|
|
cost_per_byte=cost_per_byte,
|
|
safe_mode=safe_mode,
|
|
)
|
|
# build removals list
|
|
for npc in npc_result.npc_list:
|
|
removals.append(npc.coin_name)
|
|
additions.extend(additions_for_npc(npc_result.npc_list))
|
|
|
|
rewards = block.get_included_reward_coins()
|
|
additions.extend(rewards)
|
|
return removals, additions
|