async def empty_blockchain(request): """ Provides a list of 10 valid blocks, as well as a blockchain with 9 blocks added to it. """ bc1, connection, db_path = await create_blockchain( test_constants.replace(RUST_CONDITION_CHECKER=request.param)) yield bc1 await connection.close() bc1.shut_down() db_path.unlink()
from tests.setup_nodes import test_constants as test_constants_original from tests.util.blockchain import create_blockchain from tests.util.keyring import TempKeyring def cleanup_keyring(keyring: TempKeyring): keyring.cleanup() temp_keyring = TempKeyring() keychain = temp_keyring.get_keychain() atexit.register(cleanup_keyring, temp_keyring) # Attempt to cleanup the temp keychain test_constants = test_constants_original.replace( **{ "DISCRIMINANT_SIZE_BITS": 32, "SUB_SLOT_ITERS_STARTING": 2**12 }) bt = create_block_tools(constants=test_constants, keychain=keychain) @pytest.fixture(scope="session") def event_loop(): loop = asyncio.get_event_loop() yield loop log = logging.getLogger(__name__) @pytest.fixture(scope="function", params=[1, 2])
from chia.types.peer_info import PeerInfo from tests.block_tools import create_block_tools_async from chia.util.ints import uint16 from tests.core.node_height import node_height_at_least from tests.setup_nodes import self_hostname, setup_full_node, setup_full_system, test_constants from tests.time_out_assert import time_out_assert from tests.util.keyring import TempKeyring test_constants_modified = test_constants.replace( **{ "DIFFICULTY_STARTING": 2**8, "DISCRIMINANT_SIZE_BITS": 1024, "SUB_EPOCH_BLOCKS": 140, "WEIGHT_PROOF_THRESHOLD": 2, "WEIGHT_PROOF_RECENT_BLOCKS": 350, "MAX_SUB_SLOT_BLOCKS": 50, "NUM_SPS_SUB_SLOT": 32, # Must be a power of 2 "EPOCH_BLOCKS": 280, "SUB_SLOT_ITERS_STARTING": 2**20, "NUMBER_ZERO_BITS_PLOT_FILTER": 5, }) class TestSimulation: @pytest.fixture(scope="function") async def extra_node(self): with TempKeyring() as keychain: b_tools = await create_block_tools_async( constants=test_constants_modified, keychain=keychain) async for _ in setup_full_node(test_constants_modified,
async def two_nodes_small_freeze(self): constants = test_constants.replace(COINBASE_FREEZE_PERIOD=30) async for _ in setup_two_nodes(constants): yield _
async def wallet_node(self): constants = test_constants.replace(COINBASE_FREEZE_PERIOD=0) async for _ in setup_node_and_wallet(constants): yield _
async def two_nodes(): constants = test_constants.replace(COINBASE_FREEZE_PERIOD=0) async for _ in setup_two_nodes(constants): yield _